riscv: export kaslr offset and satp in VMCOREINFO ELF notes
PATCH 1/1 riscv: export kaslr offset and satp in VMCOREINFO ELF notes
From: Austin Kim <[email protected]>
The following options are required by the kdump crash utility for RISC-V based vmcore file:
- kaslr: If the vmcore is generated from a KASLR-enabled Linux kernel, the KASLR offset is required for the crash utility to load the vmcore. Without the proper kaslr option, the crash utility fails to load the vmcore file.
- satp: The exact root page table address helps determine the correct base PGD address.
With this patch, RISC-V VMCOREINFO ELF notes now include both kaslr and satp information.
--- arch/riscv/kernel/vmcore_info.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/riscv/kernel/vmcore_info.c +7 -0
@@ -3,6 +3,11 @@#include <linux/vmcore_info.h> #include <linux/pagemap.h> +static inline u64 get_satp_value (void ) +{ +return csr_read (CSR_SATP ); +} +void arch_crash_save_vmcoreinfo (void ) {VMCOREINFO_NUMBER (phys_ram_base);
@@ -27,5 +32,7 @@ void arch_crash_save_vmcoreinfo(void)#else vmcoreinfo_append_str ("NUMBER(va_kernel_pa_offset)=0x%lx\n" , kernel_map.va_kernel_pa_offset); +vmcoreinfo_append_str ("KERNELOFFSET=%lx\n" ,kaslr_offset ()); +vmcoreinfo_append_str ("NUMBER(satp)=0x%llx\n" ,get_satp_value ());#endif }
Signature · 1 line
2.34.1
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Austin,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.16-rc1 next-20260127]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Austin-Kim/riscv-export-kaslr-offset-and-satp-in-VMCOREINFO-ELF-notes/20260127-173528 base: linus/master patch link: https://lore.kernel.org/r/aXiF55y5D49gcpUg%40adminpc-PowerEdge-R7525 patch subject: [PATCH] riscv: export kaslr offset and satp in VMCOREINFO ELF notes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260127/[email protected]/config) compiler: riscv64-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260127/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
riscv64-linux-ld: arch/riscv/kernel/vmcore_info.o: in function `arch_crash_save_vmcoreinfo':
>> arch/riscv/kernel/vmcore_info.c:23:(.text+0x240): undefined reference to `kaslr_offset'
vim +23 arch/riscv/kernel/vmcore_info.c
cfe94d456775a4 arch/riscv/kernel/vmcore_info.c Austin Kim 2026-01-27 10
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 11 void arch_crash_save_vmcoreinfo(void)
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 12 {
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 13 VMCOREINFO_NUMBER(phys_ram_base);
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 14
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 15 vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET);
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 16 vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END);
c41bd2514184d7 arch/riscv/kernel/crash_core.c Ignat Korchagin 2023-11-29 17 #ifdef CONFIG_MMU
c41bd2514184d7 arch/riscv/kernel/crash_core.c Ignat Korchagin 2023-11-29 18 VMCOREINFO_NUMBER(VA_BITS);
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 19 vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 20 vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 21 #ifdef CONFIG_64BIT
649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 22 vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 @23 vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hello,
2026년 1월 28일 (수) AM 4:14, kernel test robot <[email protected]>님이 작성:
Quoted 19 lines
Hi Austin,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.16-rc1 next-20260127]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Austin-Kim/riscv-export-kaslr-offset-and-satp-in-VMCOREINFO-ELF-notes/20260127-173528 base: linus/master patch link: https://lore.kernel.org/r/aXiF55y5D49gcpUg%40adminpc-PowerEdge-R7525 patch subject: [PATCH] riscv: export kaslr offset and satp in VMCOREINFO ELF notes config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260127/[email protected]/config) compiler: riscv64-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260127/[email protected]/reproduce)
Quoted 10 lines
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
riscv64-linux-ld:
arch/riscv/kernel/vmcore_info.o: in function `arch_crash_save_vmcoreinfo':Quoted 1 line
Quoted 1 line
arch/riscv/kernel/vmcore_info.c:23:(.text+0x240): undefined reference to `kaslr_offset'
First, I apologize for the inconvenience.
This link error occurs when CONFIG_RANDOMIZE_BASE is disabled. In the RISC-V kernel, kaslr_offset() is only defined under CONFIG_RANDOMIZE_BASE.
I will submit a new patch shortly to avoid this kind of error.
BR,
Austin Kim
Quoted 21 lines
vim +23
arch/riscv/kernel/vmcore_info.ccfe94d456775a4 arch/riscv/kernel/vmcore_info.c Austin Kim 2026-01-27 10 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 11 void arch_crash_save_vmcoreinfo(void) 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 12 { 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 13 VMCOREINFO_NUMBER(phys_ram_base); 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 14 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 15 vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET); 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 16 vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END); c41bd2514184d7 arch/riscv/kernel/crash_core.c Ignat Korchagin 2023-11-29 17 #ifdef CONFIG_MMU c41bd2514184d7 arch/riscv/kernel/crash_core.c Ignat Korchagin 2023-11-29 18 VMCOREINFO_NUMBER(VA_BITS); 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 19 vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START); 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 20 vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END); 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 21 #ifdef CONFIG_64BIT 649d6b1019a2f2 arch/riscv/kernel/crash_core.c Xianting Tian 2022-10-26 22 vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
649d6b1019a2f2arch/riscv/kernel/crash_core.cXianting Tian 2022-10-26 @23vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki