Skip to content

Commit f3fa0ef

Browse files
ardbiesheuvelIngo Molnar
authored andcommitted
efi/libstub/x86: Deal with exit() boot service returning
Even though it is uncommon, there are cases where the Exit() EFI boot service might return, e.g., when we were booted via the EFI handover protocol from OVMF and the kernel image was specified on the command line, in which case Exit() attempts to terminate the boot manager, which is not an EFI application itself. So let's drop into an infinite loop instead of randomly executing code that isn't expecting it. Tested-by: Nathan Chancellor <[email protected]> # build Signed-off-by: Ard Biesheuvel <[email protected]> [ardb: put 'hlt' in deadloop] Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 81a3489 commit f3fa0ef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/firmware/efi/libstub/x86-stub.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ static void setup_graphics(struct boot_params *boot_params)
344344
static void __noreturn efi_exit(efi_handle_t handle, efi_status_t status)
345345
{
346346
efi_bs_call(exit, handle, status, 0, NULL);
347-
unreachable();
347+
for(;;)
348+
asm("hlt");
348349
}
349350

350351
void startup_32(struct boot_params *boot_params);

0 commit comments

Comments
 (0)