efi/esrt: Only call efi_mem_reserve() for boot services memory
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hello Ingo,
Thanks for pulling this directly. I will have another batch for efi/core by the end of the week (and another urgent patch as well).
There is one remaining issue with mixed mode that I cc'ed you and Kirill on, but since that seems to be a v4.17 regression, I will keep that as a separate thing.
Signature · 1 line
Ard.
Quoted 59 lines · tip-bot for Ard Biesheuvel
Commit-ID: 61f0d55569463a1af897117ff47d202b0ccb2e24 Gitweb: https://git.kernel.org/tip/61f0d55569463a1af897117ff47d202b0ccb2e24 Author: Ard Biesheuvel <[email protected]> AuthorDate: Mon, 16 Jul 2018 23:25:07 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 17 Jul 2018 09:15:05 +0200efi/esrt: Only call
efi_mem_reserve()for boot services memoryThe following commit:
7e1550b8f208("efi: Drop type and attribute checks inefi_mem_desc_lookup()")refactored the implementation of
efi_mem_desc_lookup()so that the type check is moved to the callers, one of which is the x86 version ofefi_arch_mem_reserve(), where we added a modified check that only takesEFI_BOOT_SERVICES_DATAregions into account.This is reasonable, since it is the only memory type that requires this, but doing so uncovered some unexpected behavior in the ESRT code, which permits the ESRT table to reside in other types of memory than what the UEFI spec mandates (i.e.,
EFI_BOOT_SERVICES_DATA), and unconditionally callsefi_mem_reserve()on the region in question. This may result in errors such asesrt: Reserving ESRT space from
0x000000009c810318to0x000000009c810350.
efi: Failed to lookup EFI memory descriptor for0x000000009c810318when the ESRT table is not in
EFI_BOOT_SERVICES_DATAmemory, but we try to reserve it nonetheless.So make the call to
efi_mem_reserve()conditional on the memory type.Signed-off-by Ard Biesheuvel <[email protected]>Cc Linus Torvalds <[email protected]>Cc Peter Jones <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Thomas Gleixner <[email protected]>Signed-off-by Ingo Molnar <[email protected]>--- drivers/firmware/efi/esrt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/firmware/efi/esrt.c +2
-1@@ -329,7 +329,8 @@ void __init efi_esrt_init(void) end = esrt_data + size;pr_info ("Reserving ESRT space from %pa to %pa.\n" , &esrt_data, &end); -efi_mem_reserve (esrt_data, esrt_data_size); +if (md.type ==EFI_BOOT_SERVICES_DATA ) +efi_mem_reserve (esrt_data, esrt_data_size);pr_debug ("esrt-init: loaded.\n" ); }
Quoted 8 lines · Ard Biesheuvel
Hello Ingo,
Thanks for pulling this directly. I will have another batch for efi/core by the end of the week (and another urgent patch as well).
There is one remaining issue with mixed mode that I cc'ed you and Kirill on, but since that seems to be a v4.17 regression, I will keep that as a separate thing.
Sounds good to me!
Thanks,
Ingo