efi/x86: Ensure that EFI_RUNTIME_MAP is enabled for kexec
authorArd Biesheuvel <ardb@kernel.org>
Wed, 2 Aug 2023 15:17:04 +0000 (17:17 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 11 Sep 2023 06:37:50 +0000 (06:37 +0000)
CONFIG_EFI_RUNTIME_MAP needs to be enabled in order for kexec to be able
to provide the required information about the EFI runtime mappings to
the incoming kernel, regardless of whether kexec_load() or
kexec_file_load() is being used. Without this information, kexec boot in
EFI mode is not possible.

The CONFIG_EFI_RUNTIME_MAP option is currently directly configurable if
CONFIG_EXPERT is enabled, so that it can be turned on for debugging
purposes even if KEXEC is not enabled. However, the upshot of this is
that it can also be disabled even when it shouldn't.

So tweak the Kconfig declarations to avoid this situation.

Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
arch/x86/Kconfig

index 982b777..66bfaba 100644 (file)
@@ -1945,6 +1945,7 @@ config EFI
        select UCS2_STRING
        select EFI_RUNTIME_WRAPPERS
        select ARCH_USE_MEMREMAP_PROT
+       select EFI_RUNTIME_MAP if KEXEC_CORE
        help
          This enables the kernel to use EFI runtime services that are
          available (such as the EFI variable services).
@@ -2020,7 +2021,6 @@ config EFI_MAX_FAKE_MEM
 config EFI_RUNTIME_MAP
        bool "Export EFI runtime maps to sysfs" if EXPERT
        depends on EFI
-       default KEXEC_CORE
        help
          Export EFI runtime memory regions to /sys/firmware/efi/runtime-map.
          That memory map is required by the 2nd kernel to set up EFI virtual