]> Git Repo - J-linux.git/commitdiff
efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption
authorArd Biesheuvel <[email protected]>
Thu, 12 Sep 2024 15:45:49 +0000 (17:45 +0200)
committerArd Biesheuvel <[email protected]>
Fri, 13 Sep 2024 06:53:03 +0000 (08:53 +0200)
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: <[email protected]>
Reported-by: Breno Leitao <[email protected]>
Tested-by: Usama Arif <[email protected]>
Reviewed-by: Ilias Apalodimas <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
drivers/firmware/efi/libstub/tpm.c

index df3182f2e63a562c75068880c8450a92194415a8..1fd6823248ab6e8276b0b33fa5c6f4727fa3649f 100644 (file)
@@ -96,7 +96,7 @@ static void efi_retrieve_tcg2_eventlog(int version, efi_physical_addr_t log_loca
        }
 
        /* Allocate space for the logs and copy them. */
-       status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
+       status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
                             sizeof(*log_tbl) + log_size, (void **)&log_tbl);
 
        if (status != EFI_SUCCESS) {
This page took 0.056877 seconds and 4 git commands to generate.