[PATCH v3 6/7] x86/crash: make device backed vmemmap dumpable for kexec_file_load
Li Zhijian
lizhijian at fujitsu.com
Wed Mar 6 02:28:45 PST 2024
Add resources with specific flags to PT_LOADs of the elfcorehdr so that
these resources can be dumpable. This change is for kexec_file_load(2)
while kexec_load(2) setups the PT_LOADs according to its parameters
by the callers which usually rely on resources' name from /proc/iomem
CC: Thomas Gleixner <tglx at linutronix.de>
CC: Ingo Molnar <mingo at redhat.com>
CC: Borislav Petkov <bp at alien8.de>
CC: Dave Hansen <dave.hansen at linux.intel.com>
CC: Baoquan He <bhe at redhat.com>
CC: Andrew Morton <akpm at linux-foundation.org>
CC: "H. Peter Anvin" <hpa at zytor.com>
CC: x86 at kernel.org
Signed-off-by: Li Zhijian <lizhijian at fujitsu.com>
---
arch/x86/kernel/crash.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index b6b044356f1b..b8426fedd2cd 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -146,6 +146,8 @@ static struct crash_mem *fill_up_crash_elf_data(void)
if (!nr_ranges)
return NULL;
+ walk_device_backed_vmemmap_res(0, -1, &nr_ranges,
+ get_nr_ram_ranges_callback);
/*
* Exclusion of crash region and/or crashk_low_res may cause
* another range split. So add extra two slots here.
@@ -212,6 +214,9 @@ static int prepare_elf_headers(void **addr, unsigned long *sz,
if (ret)
goto out;
+ walk_device_backed_vmemmap_res(0, -1, cmem,
+ prepare_elf64_ram_headers_callback);
+
/* Exclude unwanted mem ranges */
ret = elf_header_exclude_ranges(cmem);
if (ret)
--
2.29.2
More information about the kexec
mailing list