Re: [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
Wed May 20 00:35:20 PDT 2026


horms at kernel.org wrote:
> On Mon, May 18, 2026 at 03:01:40PM +0800, hu.shengming at zte.com.cn wrote:
> > 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>
> 
> Hi,
> 
> I am wondering if to_be_excluded() also needs to be updated.
> And, if so, should that change also be made for ARM64.
> 
> Review assisted by gemini-3-pro-preview

Thanks for taking a look.

On arm64, the kernel code contains text and rodata section, and the kernel data 
contains data and bss section. Therefore, the arm64 architecture does not have
a similar issue.

Yes, on RISC-V, the to_be_excluded function does not properly handle the kernel
memory range, it is still being excluded.

  cat /proc/iomem | grep Kernel
    878a02000-87a8426e7 : Kernel image
    878a02000-87944d309 : Kernel code
    879c00000-87a1fffff : Kernel rodata
    87a400000-87a7741ff : Kernel data
    87a775000-87a8426e7 : Kernel bss

Maybe we can directly use the kernel image in iomem_range_callback, and only the
reserved memory needs to be excluded, like this:

  static int iomem_range_callback(...)
  {
  	....
  	else if (!strncmp(str, KERNEL_IMAGE, strlen(KERNEL_IMAGE))) {
  			elf_info.kern_paddr_start = base;
  			elf_info.kern_size = length;
  	}
  
  	return 0;
  }

  static bool to_be_excluded(...)
  {
   ...
  	  if (!strncmp(str, IOMEM_RESERVED, strlen(IOMEM_RESERVED)))
  		  return true;
  
  	  return false;
  }

If you think this change is acceptable, I will resubmit patch v3 later.
---
Thanks
Luo Haiyang



More information about the kexec mailing list