kexec: don't act as EFI chainloader if noefi.
Subsystems (3)
PATCH 1/1 kexec: don't act as EFI chainloader if noefi.
From: Christopher Koch <[email protected]>
An EFI-booted Linux kernel will commit a virtual memory map in efi_enter_virtual_mode, which is only done if efi_enabled(EFI_RUNTIME_SERVICES). This can be disabled by adding noefi to the command line.
kexec's setup_efi_state will then pass a memmap_size of 0 to the next kernel.
A Linux kernel cannot handle a memmap_size of 0 given by its bootloader:efi_memblock_x86_reserve_range divides by the memmap_size and hits a divide by 0 error.
When the 1st kernel is booted with noefi, it should not even attempt to pass EFI information to any kexec'd kernel.
--- arch/x86/kernel/kexec-bzimage64.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/kernel/kexec-bzimage64.c +8 -0
@@ -179,6 +179,14 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr,if (efi_enabled (EFI_OLD_MEMMAP ))return 0 ; +/* +* If we booted with noefi on the command line, we never committed a +* virtual memory map. It makes no sense to act as an EFI chainloader in +* that case. +*/ +if (!efi_enabled (EFI_RUNTIME_SERVICES )) +return 0 ; + ei->efi_loader_signature = current_ei->efi_loader_signature; ei->efi_systab = current_ei->efi_systab; ei->efi_systab_hi = current_ei->efi_systab_hi;
Signature · 7 lines
2.19.1.331.ge82ca0e54c-goog _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 28 lines · Chris Koch
From: Christopher Koch <[email protected]>
An EFI-booted Linux kernel will commit a virtual memory map in
efi_enter_virtual_mode, which is only done ifefi_enabled(EFI_RUNTIME_SERVICES). This can be disabled by adding noefi to the command line.kexec's
setup_efi_statewill then pass amemmap_sizeof 0 to the next kernel.A Linux kernel cannot handle a
memmap_sizeof 0 given by its bootloader:efi_memblock_x86_reserve_rangedivides by thememmap_sizeand hits a divide by 0 error.When the 1st kernel is booted with noefi, it should not even attempt to pass EFI information to any kexec'd kernel.
Signed-off-by Christopher Koch <[email protected]>--- arch/x86/kernel/kexec-bzimage64.c | 8 ++++++++ 1 file changed, 8 insertions(+)arch/x86/kernel/kexec-bzimage64.c +0
-0@@ -179,6 +179,14 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr,if (efi_enabled (EFI_OLD_MEMMAP ))
arch/x86/kernel/kexec-bzimage64.c setup_efi_state(struct boot_params *params, unsigned long params_load_addr, · line 189
Quoted 10 lines
arch/x86/kernel/kexec-bzimage64.c +8
-0return 0 ; +/* +* If we booted with noefi on the command line, we never committed a +* virtual memory map. It makes no sense to act as an EFI chainloader in +* that case. +*/ +if (!efi_enabled (EFI_RUNTIME_SERVICES )) +return 0 ; +
Previously there was a report from Mike Galbraith <[email protected]> for the case efi=noruntime, I was doing some cleanup for the kexec_file_load efi code path, but I'm occupied with some other thing, that is delayed.
I think your patch looks good, can you add more words in the code comment about efi=noruntime, also maybe mention if one want to use kexec reboot in case noefi/noruntime he should pass acpi_rsdp= param in 2nd kernel cmdline.
Quoted 11 lines
arch/x86/kernel/kexec-bzimage64.c +0
-0ei->efi_loader_signature = current_ei->efi_loader_signature; ei->efi_systab = current_ei->efi_systab; ei->efi_systab_hi = current_ei->efi_systab_hi;Signature · 7 lines
2.19.1.331.ge82ca0e54c-goog _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Thanks
Dave
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec