162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci
362306a36Sopenharmony_cimenu "Kexec and crash features"
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciconfig CRASH_CORE
662306a36Sopenharmony_ci	bool
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciconfig KEXEC_CORE
962306a36Sopenharmony_ci	select CRASH_CORE
1062306a36Sopenharmony_ci	bool
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciconfig KEXEC_ELF
1362306a36Sopenharmony_ci	bool
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciconfig HAVE_IMA_KEXEC
1662306a36Sopenharmony_ci	bool
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciconfig KEXEC
1962306a36Sopenharmony_ci	bool "Enable kexec system call"
2062306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_KEXEC
2162306a36Sopenharmony_ci	select KEXEC_CORE
2262306a36Sopenharmony_ci	help
2362306a36Sopenharmony_ci	  kexec is a system call that implements the ability to shutdown your
2462306a36Sopenharmony_ci	  current kernel, and to start another kernel. It is like a reboot
2562306a36Sopenharmony_ci	  but it is independent of the system firmware. And like a reboot
2662306a36Sopenharmony_ci	  you can start any kernel with it, not just Linux.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci	  The name comes from the similarity to the exec system call.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci	  It is an ongoing process to be certain the hardware in a machine
3162306a36Sopenharmony_ci	  is properly shutdown, so do not be surprised if this code does not
3262306a36Sopenharmony_ci	  initially work for you. As of this writing the exact hardware
3362306a36Sopenharmony_ci	  interface is strongly in flux, so no good recommendation can be
3462306a36Sopenharmony_ci	  made.
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciconfig KEXEC_FILE
3762306a36Sopenharmony_ci	bool "Enable kexec file based system call"
3862306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_KEXEC_FILE
3962306a36Sopenharmony_ci	select CRYPTO
4062306a36Sopenharmony_ci	select CRYPTO_SHA256
4162306a36Sopenharmony_ci	select KEXEC_CORE
4262306a36Sopenharmony_ci	help
4362306a36Sopenharmony_ci	  This is new version of kexec system call. This system call is
4462306a36Sopenharmony_ci	  file based and takes file descriptors as system call argument
4562306a36Sopenharmony_ci	  for kernel and initramfs as opposed to list of segments as
4662306a36Sopenharmony_ci	  accepted by kexec system call.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciconfig KEXEC_SIG
4962306a36Sopenharmony_ci	bool "Verify kernel signature during kexec_file_load() syscall"
5062306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_KEXEC_SIG
5162306a36Sopenharmony_ci	depends on KEXEC_FILE
5262306a36Sopenharmony_ci	help
5362306a36Sopenharmony_ci	  This option makes the kexec_file_load() syscall check for a valid
5462306a36Sopenharmony_ci	  signature of the kernel image. The image can still be loaded without
5562306a36Sopenharmony_ci	  a valid signature unless you also enable KEXEC_SIG_FORCE, though if
5662306a36Sopenharmony_ci	  there's a signature that we can check, then it must be valid.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci	  In addition to this option, you need to enable signature
5962306a36Sopenharmony_ci	  verification for the corresponding kernel image type being
6062306a36Sopenharmony_ci	  loaded in order for this to work.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ciconfig KEXEC_SIG_FORCE
6362306a36Sopenharmony_ci	bool "Require a valid signature in kexec_file_load() syscall"
6462306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_KEXEC_SIG_FORCE
6562306a36Sopenharmony_ci	depends on KEXEC_SIG
6662306a36Sopenharmony_ci	help
6762306a36Sopenharmony_ci	  This option makes kernel signature verification mandatory for
6862306a36Sopenharmony_ci	  the kexec_file_load() syscall.
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciconfig KEXEC_IMAGE_VERIFY_SIG
7162306a36Sopenharmony_ci	bool "Enable Image signature verification support (ARM)"
7262306a36Sopenharmony_ci	default ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG
7362306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_KEXEC_IMAGE_VERIFY_SIG
7462306a36Sopenharmony_ci	depends on KEXEC_SIG
7562306a36Sopenharmony_ci	depends on EFI && SIGNED_PE_FILE_VERIFICATION
7662306a36Sopenharmony_ci	help
7762306a36Sopenharmony_ci	  Enable Image signature verification support.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ciconfig KEXEC_BZIMAGE_VERIFY_SIG
8062306a36Sopenharmony_ci	bool "Enable bzImage signature verification support"
8162306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG
8262306a36Sopenharmony_ci	depends on KEXEC_SIG
8362306a36Sopenharmony_ci	depends on SIGNED_PE_FILE_VERIFICATION
8462306a36Sopenharmony_ci	select SYSTEM_TRUSTED_KEYRING
8562306a36Sopenharmony_ci	help
8662306a36Sopenharmony_ci	  Enable bzImage signature verification support.
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ciconfig KEXEC_JUMP
8962306a36Sopenharmony_ci	bool "kexec jump"
9062306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_KEXEC_JUMP
9162306a36Sopenharmony_ci	depends on KEXEC && HIBERNATION
9262306a36Sopenharmony_ci	help
9362306a36Sopenharmony_ci	  Jump between original kernel and kexeced kernel and invoke
9462306a36Sopenharmony_ci	  code in physical address mode via KEXEC
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ciconfig CRASH_DUMP
9762306a36Sopenharmony_ci	bool "kernel crash dumps"
9862306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_CRASH_DUMP
9962306a36Sopenharmony_ci	select CRASH_CORE
10062306a36Sopenharmony_ci	select KEXEC_CORE
10162306a36Sopenharmony_ci	help
10262306a36Sopenharmony_ci	  Generate crash dump after being started by kexec.
10362306a36Sopenharmony_ci	  This should be normally only set in special crash dump kernels
10462306a36Sopenharmony_ci	  which are loaded in the main kernel with kexec-tools into
10562306a36Sopenharmony_ci	  a specially reserved region and then later executed after
10662306a36Sopenharmony_ci	  a crash by kdump/kexec. The crash dump kernel must be compiled
10762306a36Sopenharmony_ci	  to a memory address not used by the main kernel or BIOS using
10862306a36Sopenharmony_ci	  PHYSICAL_START, or it must be built as a relocatable image
10962306a36Sopenharmony_ci	  (CONFIG_RELOCATABLE=y).
11062306a36Sopenharmony_ci	  For more details see Documentation/admin-guide/kdump/kdump.rst
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci	  For s390, this option also enables zfcpdump.
11362306a36Sopenharmony_ci	  See also <file:Documentation/s390/zfcpdump.rst>
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ciconfig CRASH_HOTPLUG
11662306a36Sopenharmony_ci	bool "Update the crash elfcorehdr on system configuration changes"
11762306a36Sopenharmony_ci	default y
11862306a36Sopenharmony_ci	depends on CRASH_DUMP && (HOTPLUG_CPU || MEMORY_HOTPLUG)
11962306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_CRASH_HOTPLUG
12062306a36Sopenharmony_ci	help
12162306a36Sopenharmony_ci	  Enable direct update to the crash elfcorehdr (which contains
12262306a36Sopenharmony_ci	  the list of CPUs and memory regions to be dumped upon a crash)
12362306a36Sopenharmony_ci	  in response to hot plug/unplug or online/offline of CPUs or
12462306a36Sopenharmony_ci	  memory. This is a much more advanced approach than userspace
12562306a36Sopenharmony_ci	  attempting that.
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci	  If unsure, say Y.
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ciconfig CRASH_MAX_MEMORY_RANGES
13062306a36Sopenharmony_ci	int "Specify the maximum number of memory regions for the elfcorehdr"
13162306a36Sopenharmony_ci	default 8192
13262306a36Sopenharmony_ci	depends on CRASH_HOTPLUG
13362306a36Sopenharmony_ci	help
13462306a36Sopenharmony_ci	  For the kexec_file_load() syscall path, specify the maximum number of
13562306a36Sopenharmony_ci	  memory regions that the elfcorehdr buffer/segment can accommodate.
13662306a36Sopenharmony_ci	  These regions are obtained via walk_system_ram_res(); eg. the
13762306a36Sopenharmony_ci	  'System RAM' entries in /proc/iomem.
13862306a36Sopenharmony_ci	  This value is combined with NR_CPUS_DEFAULT and multiplied by
13962306a36Sopenharmony_ci	  sizeof(Elf64_Phdr) to determine the final elfcorehdr memory buffer/
14062306a36Sopenharmony_ci	  segment size.
14162306a36Sopenharmony_ci	  The value 8192, for example, covers a (sparsely populated) 1TiB system
14262306a36Sopenharmony_ci	  consisting of 128MiB memblocks, while resulting in an elfcorehdr
14362306a36Sopenharmony_ci	  memory buffer/segment size under 1MiB. This represents a sane choice
14462306a36Sopenharmony_ci	  to accommodate both baremetal and virtual machine configurations.
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci	  For the kexec_load() syscall path, CRASH_MAX_MEMORY_RANGES is part of
14762306a36Sopenharmony_ci	  the computation behind the value provided through the
14862306a36Sopenharmony_ci	  /sys/kernel/crash_elfcorehdr_size attribute.
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ciendmenu
151