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 <[email protected]>
CC: Ingo Molnar <[email protected]>
CC: Borislav Petkov <[email protected]>
CC: Dave Hansen <[email protected]>
CC: Baoquan He <[email protected]>
CC: Andrew Morton <[email protected]>
CC: "H. Peter Anvin" <[email protected]>
CC: [email protected]
Signed-off-by: Li Zhijian <[email protected]>
---
 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


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to