]> www.infradead.org Git - users/jedix/linux-maple.git/commit
efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption
authorArd Biesheuvel <ardb@kernel.org>
Thu, 12 Sep 2024 15:45:49 +0000 (17:45 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Fri, 13 Sep 2024 06:53:03 +0000 (08:53 +0200)
commit77d48d39e99170b528e4f2e9fc5d1d64cdedd386
tree650d0ff880fe5f99abdcd59bf3879d6f9947ef89
parentd7171eb494353e03f3cde1a6f665e19c243c98e8
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>
drivers/firmware/efi/libstub/tpm.c