Skip to contentSkip to conversation

check for invalid physical address of /proc/kcore when make ELF format dumpfile

PATCH Applied Tao Liu 2 participants 2 messages Jun 18, 2021 – Jun 22, 2021

Subsystems (2)
lore
Share & tools
lore

Tao Liu

author
#0 lore raw

PATCH 1/1 check for invalid physical address of /proc/kcore when make ELF format dumpfile

Previously when executing makedumpfile with -E option against /proc/kcore, makedumpfile will fail:

    $ sudo makedumpfile -E -d 31 /proc/kcore vmcore
    ...
    write_elf_load_segment: Can't convert physaddr(ffffffffffffffff) to an
    offset.

makedumpfile Failed.

It's because /proc/kcore contains PT_LOAD program headers which have physaddr(ffffffffffffffff). With -E option, makedumpfile will try to convert the physaddr to an offset and fails.

In this patch, let's skip the PT_LOAD program headers which have such physaddr.

---
 makedumpfile.c | 3 +++
 1 file changed, 3 insertions(+)
makedumpfile.c +3 -0
index 894c88e..8c93c54 100644
@@ -7767,6 +7767,9 @@ write_elf_pages_cyclic(struct cache_data *cd_header, struct cache_data *cd_page)
 		if (load.p_type != PT_LOAD)
 			continue;
 
+		if (load.p_paddr == -1)
+			continue;
+
 		off_memory= load.p_offset;
 		paddr = load.p_paddr;
 		pfn_start = paddr_to_pfn(load.p_paddr);
Signature · 7 lines
2.29.2


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

-----Original Message-----

Quoted 10 lines

Previously when executing makedumpfile with -E option against /proc/kcore, makedumpfile will fail:

    $ sudo makedumpfile -E -d 31 /proc/kcore vmcore
    ...
    write_elf_load_segment: Can't convert physaddr(ffffffffffffffff) to an
    offset.

makedumpfile Failed.

Quoted 7 lines

It's because /proc/kcore contains PT_LOAD program headers which have physaddr(ffffffffffffffff). With -E option, makedumpfile will try to convert the physaddr to an offset and fails.

In this patch, let's skip the PT_LOAD program headers which have such physaddr.

Thanks, applied with adjusting to the previous similar patch.
https://github.com/makedumpfile/makedumpfile/commit/9a6f589d99dcef114c89fde992157f5467028c8f

Kazu

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