From: Luo Haiyang <[email protected]> The kdump service reported the following error:
No program header covering vaddr 0xffffffff819fa200 found kexec bug? saving vmcore-dmesg.txt failed prb stores the address of printk_rb_dynamic, which resides in the bss segment. But the PHDR (Program Header) does not contains it. The correct approach is to use the entire kernel memory range (includs text, rodata, data, bss) to create the Kernel text Elf header. On RISC-V, we can use the "kernel image" directly, which can be read from /proc/iomem. Signed-off-by: Luo Haiyang <[email protected]> --- kexec/arch/riscv/crashdump-riscv.c | 10 +++++----- kexec/arch/riscv/iomem.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kexec/arch/riscv/crashdump-riscv.c b/kexec/arch/riscv/crashdump-riscv.c index 6875249..deb9a49 100644 --- a/kexec/arch/riscv/crashdump-riscv.c +++ b/kexec/arch/riscv/crashdump-riscv.c @@ -80,16 +80,16 @@ static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr), char *str, unsigned long long base, unsigned long long length) { - if (strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)) == 0) + if (strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)) == 0) { return mem_regions_alloc_and_add(&crash_mem_ranges, base, length, RANGE_RAM); - else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0) + } else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0) { return mem_regions_alloc_and_add(&system_mem_ranges, base, length, RANGE_RAM); - else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0) + } else if (strncmp(str, KERNEL_IMAGE, strlen(KERNEL_IMAGE)) == 0) { elf_info.kern_paddr_start = base; - else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0) - elf_info.kern_size = base + length - elf_info.kern_paddr_start; + elf_info.kern_size = length; + } return 0; } diff --git a/kexec/arch/riscv/iomem.h b/kexec/arch/riscv/iomem.h index 7671e26..86da971 100644 --- a/kexec/arch/riscv/iomem.h +++ b/kexec/arch/riscv/iomem.h @@ -4,6 +4,7 @@ #define SYSTEM_RAM "System RAM\n" #define KERNEL_CODE "Kernel code\n" #define KERNEL_DATA "Kernel data\n" +#define KERNEL_IMAGE "Kernel image\n" #define CRASH_KERNEL "Crash kernel\n" #define IOMEM_RESERVED "Reserved\n" -- 2.27.0
