Do not tear down the system when getting invalid status from a TPM chip.
This can happen when panic-on-warn is used.
Instead, introduce TPM_TIS_INVALID_STATUS bitflag and use it to trigger
once the error reporting per chip. In addition, print out the value of
TPM_STS for improved forensics.
Link: https://lore.kernel.org/keyrings/YKzlTR1AzUigShtZ@kroah.com/
Fixes: 55707d531af6 ("tpm_tis: Add a check for invalid status")
Cc: stable(a)vger.kernel.org
Cc: Hans de Goede <hdegoede(a)redhat.com>
Cc: Greg KH <greg(a)kroah.com>
Signed-off-by: Jarkko Sakkinen <jarkko(a)kernel.org>
---
v3:
* torn -> tear
* A per chip flag TPM_TIS_INVALID_STATUS.
v2:
Dump also stack only once.
drivers/char/tpm/tpm_tis_core.c | 25 ++++++++++++++++++-------
drivers/char/tpm/tpm_tis_core.h | 3 ++-
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 55b9d3965ae1..69579efb247b 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -196,13 +196,24 @@ static u8 tpm_tis_status(struct tpm_chip *chip)
return 0;
if (unlikely((status & TPM_STS_READ_ZERO) != 0)) {
- /*
- * If this trips, the chances are the read is
- * returning 0xff because the locality hasn't been
- * acquired. Usually because tpm_try_get_ops() hasn't
- * been called before doing a TPM operation.
- */
- WARN_ONCE(1, "TPM returned invalid status\n");
+ if (!test_and_set_bit(TPM_TIS_INVALID_STATUS, &priv->flags)) {
+ /*
+ * If this trips, the chances are the read is
+ * returning 0xff because the locality hasn't been
+ * acquired. Usually because tpm_try_get_ops() hasn't
+ * been called before doing a TPM operation.
+ */
+ dev_err(&chip->dev, "invalid TPM_STS.x 0x%02x, dumping stack for forensics\n",
+ status);
+
+ /*
+ * Dump stack for forensics, as invalid TPM_STS.x could be
+ * potentially triggered by impaired tpm_try_get_ops() or
+ * tpm_find_get_ops().
+ */
+ dump_stack();
+ }
+
return 0;
}
diff --git a/drivers/char/tpm/tpm_tis_core.h b/drivers/char/tpm/tpm_tis_core.h
index 9b2d32a59f67..b2a3c6c72882 100644
--- a/drivers/char/tpm/tpm_tis_core.h
+++ b/drivers/char/tpm/tpm_tis_core.h
@@ -83,6 +83,7 @@ enum tis_defaults {
enum tpm_tis_flags {
TPM_TIS_ITPM_WORKAROUND = BIT(0),
+ TPM_TIS_INVALID_STATUS = BIT(1),
};
struct tpm_tis_data {
@@ -90,7 +91,7 @@ struct tpm_tis_data {
int locality;
int irq;
bool irq_tested;
- unsigned int flags;
+ unsigned long flags;
void __iomem *ilb_base_addr;
u16 clkrun_enabled;
wait_queue_head_t int_queue;
--
2.31.1
This is the start of the stable review cycle for the 4.14.236 release.
There are 47 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.236-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.14.236-rc1
Jan Beulich <jbeulich(a)suse.com>
xen-pciback: redo VF placement in the virtual topology
Cheng Jian <cj.chengjian(a)huawei.com>
sched/fair: Optimize select_idle_cpu
Sean Christopherson <seanjc(a)google.com>
KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit mode
Michael Chan <michael.chan(a)broadcom.com>
bnxt_en: Remove the setting of dev_port.
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: No need to simulate speculative domain for immediates
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Fix mask direction swap upon off reg sign change
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Wrap aux data inside bpf_sanitize_info container
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Fix leakage of uninitialized bpf stack under speculation
Alexei Starovoitov <ast(a)kernel.org>
selftests/bpf: make 'dubious pointer arithmetic' test useful
Alexei Starovoitov <ast(a)fb.com>
selftests/bpf: fix test_align
Alexei Starovoitov <ast(a)kernel.org>
bpf/verifier: disallow pointer subtraction
Alexei Starovoitov <ast(a)kernel.org>
bpf: do not allow root to mangle valid pointers
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Update selftests to reflect new error states
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Tighten speculative pointer arithmetic mask
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Move sanitize_val_alu out of op switch
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Refactor and streamline bounds check into helper
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Improve verifier error messages for users
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Rework ptr_limit into alu_limit and add common error path
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Ensure off_reg has no mixed signed bounds for all types
Daniel Borkmann <daniel(a)iogearbox.net>
bpf: Move off_reg into sanitize_ptr_alu
Piotr Krysiuk <piotras(a)gmail.com>
bpf, selftests: Fix up some test_verifier cases for unprivileged
Mina Almasry <almasrymina(a)google.com>
mm, hugetlb: fix simple resv_huge_pages underflow on UFFDIO_COPY
Josef Bacik <josef(a)toxicpanda.com>
btrfs: fixup error handling in fixup_inode_link_counts
Josef Bacik <josef(a)toxicpanda.com>
btrfs: fix error handling in btrfs_del_csums
Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
nfc: fix NULL ptr dereference in llcp_sock_getname() after failed connect
Junxiao Bi <junxiao.bi(a)oracle.com>
ocfs2: fix data corruption by fallocate
Mark Rutland <mark.rutland(a)arm.com>
pid: take a reference when initializing `cad_pid`
Ye Bin <yebin10(a)huawei.com>
ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed
Takashi Iwai <tiwai(a)suse.de>
ALSA: timer: Fix master timer notification
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: fix memory leak in cfusbl_device_notify
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: fix memory leak in caif_device_notify
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: add proper error handling
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: added cfserl_release function
Lin Ma <linma(a)zju.edu.cn>
Bluetooth: use correct lock to prevent UAF of hdev object
Lin Ma <linma(a)zju.edu.cn>
Bluetooth: fix the erroneous flush_work() order
Wei Yongjun <weiyongjun1(a)huawei.com>
ieee802154: fix error return code in ieee802154_llsec_getparams()
Zhen Lei <thunder.leizhen(a)huawei.com>
ieee802154: fix error return code in ieee802154_add_iface()
Pablo Neira Ayuso <pablo(a)netfilter.org>
netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches
Arnd Bergmann <arnd(a)arndb.de>
HID: i2c-hid: fix format string mismatch
Zhen Lei <thunder.leizhen(a)huawei.com>
HID: pidff: fix error return code in hid_pidff_init()
Julian Anastasov <ja(a)ssi.bg>
ipvs: ignore IP_VS_SVC_F_HASHED flag when adding service
Max Gurtovoy <mgurtovoy(a)nvidia.com>
vfio/platform: fix module_put call in error flow
Randy Dunlap <rdunlap(a)infradead.org>
vfio/pci: zap_vma_ptes() needs MMU
Zhen Lei <thunder.leizhen(a)huawei.com>
vfio/pci: Fix error return code in vfio_ecap_init()
Rasmus Villemoes <linux(a)rasmusvillemoes.dk>
efi: cper: fix snprintf() use in cper_dimm_err_location()
Heiner Kallweit <hkallweit1(a)gmail.com>
efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared
Grant Grundler <grundler(a)chromium.org>
net: usb: cdc_ncm: don't spew notifications
-------------
Diffstat:
Makefile | 4 +-
arch/x86/kvm/svm.c | 8 +-
drivers/firmware/efi/cper.c | 4 +-
drivers/firmware/efi/memattr.c | 5 -
drivers/hid/i2c-hid/i2c-hid-core.c | 4 +-
drivers/hid/usbhid/hid-pidff.c | 1 +
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 -
drivers/net/usb/cdc_ncm.c | 12 +-
drivers/vfio/pci/Kconfig | 1 +
drivers/vfio/pci/vfio_pci_config.c | 2 +-
drivers/vfio/platform/vfio_platform_common.c | 2 +-
drivers/xen/xen-pciback/vpci.c | 14 +-
fs/btrfs/file-item.c | 10 +-
fs/btrfs/tree-log.c | 13 +-
fs/ext4/extents.c | 43 ++--
fs/ocfs2/file.c | 55 +++-
include/linux/bpf_verifier.h | 5 +-
include/linux/usb/usbnet.h | 2 +
include/net/caif/caif_dev.h | 2 +-
include/net/caif/cfcnfg.h | 2 +-
include/net/caif/cfserl.h | 1 +
init/main.c | 2 +-
kernel/bpf/verifier.c | 369 ++++++++++++++++-----------
kernel/sched/fair.c | 7 +-
mm/hugetlb.c | 14 +-
net/bluetooth/hci_core.c | 7 +-
net/bluetooth/hci_sock.c | 4 +-
net/caif/caif_dev.c | 13 +-
net/caif/caif_usb.c | 14 +-
net/caif/cfcnfg.c | 16 +-
net/caif/cfserl.c | 5 +
net/ieee802154/nl-mac.c | 4 +-
net/ieee802154/nl-phy.c | 4 +-
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
net/netfilter/nfnetlink_cthelper.c | 8 +-
net/nfc/llcp_sock.c | 2 +
sound/core/timer.c | 3 +-
tools/testing/selftests/bpf/test_align.c | 26 +-
tools/testing/selftests/bpf/test_verifier.c | 114 +++++----
39 files changed, 501 insertions(+), 304 deletions(-)
This is the start of the stable review cycle for the 4.9.272 release.
There are 29 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.272-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.9.272-rc1
Jan Beulich <jbeulich(a)suse.com>
xen-pciback: redo VF placement in the virtual topology
Michael Weiser <michael.weiser(a)gmx.de>
arm64: Remove unimplemented syscall log message
Sean Christopherson <seanjc(a)google.com>
KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit mode
Michael Chan <michael.chan(a)broadcom.com>
bnxt_en: Remove the setting of dev_port.
Josef Bacik <josef(a)toxicpanda.com>
btrfs: fixup error handling in fixup_inode_link_counts
Josef Bacik <josef(a)toxicpanda.com>
btrfs: fix error handling in btrfs_del_csums
Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
nfc: fix NULL ptr dereference in llcp_sock_getname() after failed connect
Junxiao Bi <junxiao.bi(a)oracle.com>
ocfs2: fix data corruption by fallocate
Mark Rutland <mark.rutland(a)arm.com>
pid: take a reference when initializing `cad_pid`
Ye Bin <yebin10(a)huawei.com>
ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed
Takashi Iwai <tiwai(a)suse.de>
ALSA: timer: Fix master timer notification
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: fix memory leak in cfusbl_device_notify
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: fix memory leak in caif_device_notify
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: add proper error handling
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: added cfserl_release function
Lin Ma <linma(a)zju.edu.cn>
Bluetooth: use correct lock to prevent UAF of hdev object
Lin Ma <linma(a)zju.edu.cn>
Bluetooth: fix the erroneous flush_work() order
Wei Yongjun <weiyongjun1(a)huawei.com>
ieee802154: fix error return code in ieee802154_llsec_getparams()
Zhen Lei <thunder.leizhen(a)huawei.com>
ieee802154: fix error return code in ieee802154_add_iface()
Pablo Neira Ayuso <pablo(a)netfilter.org>
netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches
Arnd Bergmann <arnd(a)arndb.de>
HID: i2c-hid: fix format string mismatch
Zhen Lei <thunder.leizhen(a)huawei.com>
HID: pidff: fix error return code in hid_pidff_init()
Julian Anastasov <ja(a)ssi.bg>
ipvs: ignore IP_VS_SVC_F_HASHED flag when adding service
Max Gurtovoy <mgurtovoy(a)nvidia.com>
vfio/platform: fix module_put call in error flow
Randy Dunlap <rdunlap(a)infradead.org>
vfio/pci: zap_vma_ptes() needs MMU
Zhen Lei <thunder.leizhen(a)huawei.com>
vfio/pci: Fix error return code in vfio_ecap_init()
Rasmus Villemoes <linux(a)rasmusvillemoes.dk>
efi: cper: fix snprintf() use in cper_dimm_err_location()
Heiner Kallweit <hkallweit1(a)gmail.com>
efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared
Grant Grundler <grundler(a)chromium.org>
net: usb: cdc_ncm: don't spew notifications
-------------
Diffstat:
Makefile | 4 +-
arch/arm64/kernel/traps.c | 8 ----
arch/x86/kvm/svm.c | 8 ++--
drivers/firmware/efi/cper.c | 4 +-
drivers/firmware/efi/memattr.c | 5 ---
drivers/hid/i2c-hid/i2c-hid-core.c | 4 +-
drivers/hid/usbhid/hid-pidff.c | 1 +
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 -
drivers/net/usb/cdc_ncm.c | 12 +++++-
drivers/vfio/pci/Kconfig | 1 +
drivers/vfio/pci/vfio_pci_config.c | 2 +-
drivers/vfio/platform/vfio_platform_common.c | 2 +-
drivers/xen/xen-pciback/vpci.c | 14 ++++---
fs/btrfs/file-item.c | 10 ++---
fs/btrfs/tree-log.c | 13 ++++---
fs/ext4/extents.c | 43 ++++++++++++----------
fs/ocfs2/file.c | 55 +++++++++++++++++++++++++---
include/linux/usb/usbnet.h | 2 +
include/net/caif/caif_dev.h | 2 +-
include/net/caif/cfcnfg.h | 2 +-
include/net/caif/cfserl.h | 1 +
init/main.c | 2 +-
net/bluetooth/hci_core.c | 7 +++-
net/bluetooth/hci_sock.c | 4 +-
net/caif/caif_dev.c | 13 +++++--
net/caif/caif_usb.c | 14 ++++++-
net/caif/cfcnfg.c | 16 +++++---
net/caif/cfserl.c | 5 +++
net/ieee802154/nl-mac.c | 4 +-
net/ieee802154/nl-phy.c | 4 +-
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
net/netfilter/nfnetlink_cthelper.c | 8 +++-
net/nfc/llcp_sock.c | 2 +
sound/core/timer.c | 3 +-
34 files changed, 186 insertions(+), 92 deletions(-)
This is the start of the stable review cycle for the 4.4.272 release.
There are 23 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.272-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.4.272-rc1
Jan Beulich <jbeulich(a)suse.com>
xen-pciback: redo VF placement in the virtual topology
Michael Weiser <michael.weiser(a)gmx.de>
arm64: Remove unimplemented syscall log message
Sean Christopherson <seanjc(a)google.com>
KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit mode
Josef Bacik <josef(a)toxicpanda.com>
btrfs: fixup error handling in fixup_inode_link_counts
Krzysztof Kozlowski <krzysztof.kozlowski(a)canonical.com>
nfc: fix NULL ptr dereference in llcp_sock_getname() after failed connect
Junxiao Bi <junxiao.bi(a)oracle.com>
ocfs2: fix data corruption by fallocate
Mark Rutland <mark.rutland(a)arm.com>
pid: take a reference when initializing `cad_pid`
Ye Bin <yebin10(a)huawei.com>
ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed
Takashi Iwai <tiwai(a)suse.de>
ALSA: timer: Fix master timer notification
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: fix memory leak in cfusbl_device_notify
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: fix memory leak in caif_device_notify
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: add proper error handling
Pavel Skripkin <paskripkin(a)gmail.com>
net: caif: added cfserl_release function
Lin Ma <linma(a)zju.edu.cn>
Bluetooth: use correct lock to prevent UAF of hdev object
Lin Ma <linma(a)zju.edu.cn>
Bluetooth: fix the erroneous flush_work() order
Wei Yongjun <weiyongjun1(a)huawei.com>
ieee802154: fix error return code in ieee802154_llsec_getparams()
Zhen Lei <thunder.leizhen(a)huawei.com>
ieee802154: fix error return code in ieee802154_add_iface()
Pablo Neira Ayuso <pablo(a)netfilter.org>
netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches
Zhen Lei <thunder.leizhen(a)huawei.com>
HID: pidff: fix error return code in hid_pidff_init()
Julian Anastasov <ja(a)ssi.bg>
ipvs: ignore IP_VS_SVC_F_HASHED flag when adding service
Max Gurtovoy <mgurtovoy(a)nvidia.com>
vfio/platform: fix module_put call in error flow
Zhen Lei <thunder.leizhen(a)huawei.com>
vfio/pci: Fix error return code in vfio_ecap_init()
Rasmus Villemoes <linux(a)rasmusvillemoes.dk>
efi: cper: fix snprintf() use in cper_dimm_err_location()
-------------
Diffstat:
Makefile | 4 +-
arch/arm64/kernel/traps.c | 8 ----
arch/x86/kvm/svm.c | 8 ++--
drivers/firmware/efi/cper.c | 4 +-
drivers/hid/usbhid/hid-pidff.c | 1 +
drivers/vfio/pci/vfio_pci_config.c | 2 +-
drivers/vfio/platform/vfio_platform_common.c | 2 +-
drivers/xen/xen-pciback/vpci.c | 14 ++++---
fs/btrfs/tree-log.c | 13 ++++---
fs/ext4/extents.c | 43 ++++++++++++----------
fs/ocfs2/file.c | 55 +++++++++++++++++++++++++---
include/net/caif/caif_dev.h | 2 +-
include/net/caif/cfcnfg.h | 2 +-
include/net/caif/cfserl.h | 1 +
init/main.c | 2 +-
net/bluetooth/hci_core.c | 7 +++-
net/bluetooth/hci_sock.c | 4 +-
net/caif/caif_dev.c | 13 +++++--
net/caif/caif_usb.c | 14 ++++++-
net/caif/cfcnfg.c | 16 +++++---
net/caif/cfserl.c | 5 +++
net/ieee802154/nl-mac.c | 4 +-
net/ieee802154/nl-phy.c | 4 +-
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
net/netfilter/nfnetlink_cthelper.c | 8 +++-
net/nfc/llcp_sock.c | 2 +
sound/core/timer.c | 3 +-
27 files changed, 165 insertions(+), 78 deletions(-)