From: Ard Biesheuvel Date: Sun, 8 Mar 2020 08:08:45 +0000 (+0100) Subject: efi/libstub/x86: Deal with exit() boot service returning X-Git-Tag: v5.7-rc1~182^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f3fa0efce2e765f24356b70bd0786f290d84328c;p=thirdparty%2Fkernel%2Flinux.git 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 # build Signed-off-by: Ard Biesheuvel [ardb: put 'hlt' in deadloop] Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200303080648.21427-1-ardb@kernel.org Link: https://lore.kernel.org/r/20200308080859.21568-15-ardb@kernel.org --- diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index 7f3e97c2aad31..69a942f0640bd 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -344,7 +344,8 @@ static void setup_graphics(struct boot_params *boot_params) static void __noreturn efi_exit(efi_handle_t handle, efi_status_t status) { efi_bs_call(exit, handle, status, 0, NULL); - unreachable(); + for(;;) + asm("hlt"); } void startup_32(struct boot_params *boot_params);