efi/libstub/x86: deal with exit() boot service returning
Ard Biesheuvel
maintainerPATCH 1/1 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 a deadloop instead.
---
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(-)
drivers/firmware/efi/libstub/x86-stub.c +1 -1
@@ -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);
Signature · 1 line
2.17.1
Quoted 7 lines · Ard Biesheuvel
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 caseExit()attempts to terminate the boot manager, which is not an EFI application itself. So let's drop into a deadloop instead.
Quoted 6 lines
Cc Nathan Chancellor <[email protected]>Signed-off-by Ard Biesheuvel <[email protected]>---
As a side effect, this also fixes [0], which is as yet undiagnosed.
And for that:
drivers/firmware/efi/libstub/x86-stub.c static void setup_graphics(struct boot_params *boot_params) · line 347
Quoted 13 lines
drivers/firmware/efi/libstub/x86-stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/firmware/efi/libstub/x86-stub.c +1
-1@@ -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 (;;);
I thought this would have tripped up clang's -Wempty-body but it doesn't so that is good.
Quoted 6 lines
drivers/firmware/efi/libstub/x86-stub.c +0
-0}void startup_32 (struct boot_params *boot_params);Signature · 1 line
2.17.1