CVE-2021-46951: tpm: efi: Use local variable for calculating final log size
In the Linux kernel, the following vulnerability has been resolved:
tpm: efi: Use local variable for calculating final log size
When tpm_read_log_efi is called multiple times, which happens when
one loads and unloads a TPM2 driver multiple times, then the global
variable efi_tpm_final_log_size will at some point become a negative
number due to the subtraction of final_events_preboot_size occurring
each time. Use a local variable to avoid this integer underflow.
The following issue is now resolved:
Mar 8 15:35:12 hibinst kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
Mar 8 15:35:12 hibinst kernel: Workqueue: tpm-vtpm vtpm_proxy_work [tpm_vtpm_proxy]
Mar 8 15:35:12 hibinst kernel: RIP: 0010:__memcpy+0x12/0x20
Mar 8 15:35:12 hibinst kernel: Code: 00 b8 01 00 00 00 85 d2 74 0a c7 05 44 7b ef 00 0f 00 00 00 c3 cc cc cc 66 66 90 66 90 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4
Mar 8 15:35:12 hibinst kernel: RSP: 0018:ffff9ac4c0fcfde0 EFLAGS: 00010206
Mar 8 15:35:12 hibinst kernel: RAX: ffff88f878cefed5 RBX: ffff88f878ce9000 RCX: 1ffffffffffffe0f
Mar 8 15:35:12 hibinst kernel: RDX: 0000000000000003 RSI: ffff9ac4c003bff9 RDI: ffff88f878cf0e4d
Mar 8 15:35:12 hibinst kernel: RBP: ffff9ac4c003b000 R08: 0000000000001000 R09: 000000007e9d6073
Mar 8 15:35:12 hibinst kernel: R10: ffff9ac4c003b000 R11: ffff88f879ad3500 R12: 0000000000000ed5
Mar 8 15:35:12 hibinst kernel: R13: ffff88f878ce9760 R14: 0000000000000002 R15: ffff88f77de7f018
Mar 8 15:35:12 hibinst kernel: FS: 0000000000000000(0000) GS:ffff88f87bd00000(0000) knlGS:0000000000000000
Mar 8 15:35:12 hibinst kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mar 8 15:35:12 hibinst kernel: CR2: ffff9ac4c003c000 CR3: 00000001785a6004 CR4: 0000000000060ee0
Mar 8 15:35:12 hibinst kernel: Call Trace:
Mar 8 15:35:12 hibinst kernel: tpm_read_log_efi+0x152/0x1a7
Mar 8 15:35:12 hibinst kernel: tpm_bios_log_setup+0xc8/0x1c0
Mar 8 15:35:12 hibinst kernel: tpm_chip_register+0x8f/0x260
Mar 8 15:35:12 hibinst kernel: vtpm_proxy_work+0x16/0x60 [tpm_vtpm_proxy]
Mar 8 15:35:12 hibinst kernel: process_one_work+0x1b4/0x370
Mar 8 15:35:12 hibinst kernel: worker_thread+0x53/0x3e0
Mar 8 15:35:12 hibinst kernel: ? process_one_work+0x370/0x370
Security readout for executives and security teams
Plain-English summary
CVE-2021-46951 is a Linux kernel TPM/EFI logging bug. Repeated TPM2 driver load and unload activity can corrupt an internal size calculation, leading to an integer underflow and a kernel crash path. The sources do not provide CVSS, CWE, active exploitation, or a complete privilege model.
Executive priority
Treat this as a targeted kernel stability risk rather than a proven widespread emergency. Patch through normal kernel maintenance, with higher priority for platforms depending on TPM or measured boot. Escalate if kernel logs show matching crashes or if affected kernels run on critical infrastructure.
Technical view
In tpm_read_log_efi, the global efi_tpm_final_log_size was reduced repeatedly when the function ran multiple times. That could make the value negative and feed an unsafe size into memory copying, with the cited trace crashing in __memcpy from tpm_read_log_efi. The fix uses a local variable for the final log size calculation.
Likely exposure
Exposure appears limited to affected Linux kernel versions using TPM EFI log handling, especially where TPM2 driver registration can occur repeatedly. The bundle lists Linux kernel versions including 5.3, 5.4.118, 5.10.36, 5.11.20, 5.12.3, and 5.13 as affected, but does not provide distribution package mappings.
Exploitation context
The source describes failure when tpm_read_log_efi is called multiple times after TPM2 driver load and unload cycles. KEV is false, and no cited source states active exploitation. The bundle does not establish remote exploitability, attacker privileges, or practical exploitation beyond the documented crash condition.
Researcher notes
Evidence is strong for the root cause and upstream fix, but incomplete for severity scoring. The failure involves integer underflow from repeated subtraction of final_events_preboot_size against a global final log size. Avoid assuming remote reachability or privilege requirements without vendor or kernel-maintainer confirmation.
Mitigation direction
Update affected Linux kernels to vendor builds containing the referenced stable fixes.
Prioritize systems using TPM2, EFI boot measurement logs, or virtual TPM components.
Check distribution advisories for exact package versions and backport status.
Avoid relying on raw upstream version numbers where vendors backport fixes.
Monitor vendor kernel channels because no standalone workaround is named in the bundle.
Validation and detection
Inventory Linux kernel versions across servers, workstations, and virtualized environments.
Confirm whether TPM2, EFI TPM logs, or vTPM proxy components are in use.
Compare installed kernels against vendor advisories for CVE-2021-46951.
Review kernel logs for crashes involving tpm_read_log_efi, tpm_bios_log_setup, or __memcpy.
Verify patched kernels include one of the referenced stable fix commits or vendor backports.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2021-46951 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.