Skip to content

Commit 77d48d3

Browse files
committed
efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption
The TPM event log table is a Linux specific construct, where the data produced by the GetEventLog() boot service is cached in memory, and passed on to the OS using an EFI configuration table. The use of EFI_LOADER_DATA here results in the region being left unreserved in the E820 memory map constructed by the EFI stub, and this is the memory description that is passed on to the incoming kernel by kexec, which is therefore unaware that the region should be reserved. Even though the utility of the TPM2 event log after a kexec is questionable, any corruption might send the parsing code off into the weeds and crash the kernel. So let's use EFI_ACPI_RECLAIM_MEMORY instead, which is always treated as reserved by the E820 conversion logic. Cc: <stable@vger.kernel.org> Reported-by: Breno Leitao <leitao@debian.org> Tested-by: Usama Arif <usamaarif642@gmail.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent d7171eb commit 77d48d3

File tree

1 file changed

+1
-1
lines changed
  • drivers/firmware/efi/libstub

1 file changed

+1
-1
lines changed

drivers/firmware/efi/libstub/tpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static void efi_retrieve_tcg2_eventlog(int version, efi_physical_addr_t log_loca
9696
}
9797

9898
/* Allocate space for the logs and copy them. */
99-
status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
99+
status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
100100
sizeof(*log_tbl) + log_size, (void **)&log_tbl);
101101

102102
if (status != EFI_SUCCESS) {

0 commit comments

Comments
 (0)