diff mbox series

efi/libstub/x86: deal with exit() boot service returning

Message ID 20200303080648.21427-1-ardb@kernel.org
State New
Headers show
Series efi/libstub/x86: deal with exit() boot service returning | expand

Commit Message

Ard Biesheuvel March 3, 2020, 8:06 a.m. UTC
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 a deadloop
instead.

Cc: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
As a side effect, this also fixes [0], which is as yet undiagnosed.

[0] https://github.com/ClangBuiltLinux/linux/issues/917

 drivers/firmware/efi/libstub/x86-stub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index 7f3e97c2aad3..5c7480c4d379 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -344,7 +344,7 @@  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(;;);
 }
 
 void startup_32(struct boot_params *boot_params);