All of lore.kernel.org
 help / color / mirror / Atom feed
* [makedumpfile PATCH] check for invalid physical address of /proc/kcore when make ELF format dumpfile
@ 2021-06-18 10:28 Tao Liu
  2021-06-22  2:57 ` HAGIO KAZUHITO(萩尾 一仁)
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Liu @ 2021-06-18 10:28 UTC (permalink / raw)
  To: kexec; +Cc: Tao Liu

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.

Signed-off-by: Tao Liu <ltao@redhat.com>
---
 makedumpfile.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/makedumpfile.c b/makedumpfile.c
index 894c88e..8c93c54 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -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);
-- 
2.29.2


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [makedumpfile PATCH] check for invalid physical address of /proc/kcore when make ELF format dumpfile
  2021-06-18 10:28 [makedumpfile PATCH] check for invalid physical address of /proc/kcore when make ELF format dumpfile Tao Liu
@ 2021-06-22  2:57 ` HAGIO KAZUHITO(萩尾 一仁)
  0 siblings, 0 replies; 2+ messages in thread
From: HAGIO KAZUHITO(萩尾 一仁) @ 2021-06-22  2:57 UTC (permalink / raw)
  To: Tao Liu, kexec

-----Original Message-----
> 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.
> 
> Signed-off-by: Tao Liu <ltao@redhat.com>

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

Kazu


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-22  2:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 10:28 [makedumpfile PATCH] check for invalid physical address of /proc/kcore when make ELF format dumpfile Tao Liu
2021-06-22  2:57 ` HAGIO KAZUHITO(萩尾 一仁)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.