[PATCH 3/3] RISC-V: add bss section to kernel text elf header

hu.shengming at zte.com.cn hu.shengming at zte.com.cn
Mon May 18 00:01:40 PDT 2026


From: Luo Haiyang <luo.haiyang at zte.com.cn>

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. Since printk_rb_dynamic
resides in the bss segment and the PHDR (Program Header) does not include
the bss segment address. Therefore,  add the bss segment to the Kernel text.

Signed-off-by: Luo Haiyang <luo.haiyang at zte.com.cn>
---
 kexec/arch/riscv/crashdump-riscv.c | 2 +-
 kexec/arch/riscv/iomem.h           | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/kexec/arch/riscv/crashdump-riscv.c b/kexec/arch/riscv/crashdump-riscv.c
index 6875249..a892225 100644
--- a/kexec/arch/riscv/crashdump-riscv.c
+++ b/kexec/arch/riscv/crashdump-riscv.c
@@ -88,7 +88,7 @@ static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
 						base, length, RANGE_RAM);
 	else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0)
 		elf_info.kern_paddr_start = base;
-	else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0)
+	else if (strncmp(str, KERNEL_BSS, strlen(KERNEL_BSS)) == 0)
 		elf_info.kern_size = base + length - elf_info.kern_paddr_start;

 	return 0;
diff --git a/kexec/arch/riscv/iomem.h b/kexec/arch/riscv/iomem.h
index 7671e26..fcc0d0a 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_BSS		"Kernel bss\n"
 #define CRASH_KERNEL		"Crash kernel\n"
 #define IOMEM_RESERVED		"Reserved\n"

-- 
2.27.0



More information about the kexec mailing list