Skip to content

Commit 3e03dca

Browse files
ardbiesheuvelIngo Molnar
authored andcommitted
efi: Mark all EFI runtime services as unsupported on non-EFI boot
Recent changes to the way we deal with EFI runtime services that are marked as unsupported by the firmware resulted in a regression for non-EFI boot. The problem is that all EFI runtime services are marked as available by default, and any non-NULL checks on the EFI service function pointers (which will be non-NULL even for runtime services that are unsupported on an EFI boot) were replaced with checks against the mask stored in efi.runtime_supported_mask. When doing a non-EFI boot, this check against the mask will return a false positive, given the fact that all runtime services are marked as enabled by default. Since we dropped the non-NULL check of the runtime service function pointer in favor of the mask check, we will now unconditionally dereference the function pointer, even if it is NULL, and go boom. So let's ensure that the mask reflects reality on a non-EFI boot, which is that all EFI runtime services are unsupported. Reported-by: David Hildenbrand <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: [email protected] Cc: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b967696 commit 3e03dca

File tree

1 file changed

+3
-3
lines changed
  • drivers/firmware/efi

1 file changed

+3
-3
lines changed

drivers/firmware/efi/efi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,12 @@ static int __init efisubsys_init(void)
300300
{
301301
int error;
302302

303-
if (!efi_enabled(EFI_BOOT))
304-
return 0;
305-
306303
if (!efi_enabled(EFI_RUNTIME_SERVICES))
307304
efi.runtime_supported_mask = 0;
308305

306+
if (!efi_enabled(EFI_BOOT))
307+
return 0;
308+
309309
if (efi.runtime_supported_mask) {
310310
/*
311311
* Since we process only one efi_runtime_service() at a time, an

0 commit comments

Comments
 (0)