* [MAKEDUMPFILE PATCH] makedumpfile: elf_info: check for invalid physical address when finding max_paddr
@ 2021-06-15 10:10 Coiby Xu
0 siblings, 0 replies; 4+ messages in thread
From: Coiby Xu @ 2021-06-15 10:10 UTC (permalink / raw)
To: kexec; +Cc: Xiaoying Yan
Kernel commit 464920104bf7adac12722035bfefb3d772eb04d8
"/proc/kcore: update physical address for kcore ram and text" sets an
invalid paddr (-1=0xffffffffffffffff) for PT_LOAD segments of not direct
mapped regions,
$ readelf -l /proc/kcore
Elf file type is CORE (Core file)
Entry point 0x0
There are 4 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NOTE 0x0000000000000120 0x0000000000000000 0x0000000000000000
0x0000000000002320 0x0000000000000000 0x0
LOAD 0x1000000000010000 0xd000000000000000 0xffffffffffffffff
^^^^^^^^^^^^^^^^^^
0x0001f80000000000 0x0001f80000000000 RWE 0x10000
LOAD 0x0000000000010000 0xc000000000000000 0x0000000000000000
0x00000003f0000000 0x00000003f0000000 RWE 0x10000
LOAD 0x3000000000010000 0xf000000000000000 0xffffffffffffffff
^^^^^^^^^^^^^^^^^^
0x0000000000fc0000 0x0000000000fc0000 RWE 0x10000
makedumple uses max_paddr to calculate the number of sections for sparse
memory model thus wrong number is obtained based on max_paddr=-1. This
error could lead to the failure of copying /proc/kcore for RHEL-8.5 on
ppc64le machine [1],
$ uname -r
4.18.0-312.el8.ppc64le
$ makedumpfile /proc/kcore vmcore1
get_mem_section: Could not validate mem_section.
get_mm_sparsemem: Can't get the address of mem_section.
makedumpfile Failed.
Let's check if the phys_start of the segment is a valid physical address
to fix this problem.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1965267
Reported-by: Xiaoying Yan <yiyan@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
elf_info.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elf_info.c b/elf_info.c
index e8affb7..9444847 100644
--- a/elf_info.c
+++ b/elf_info.c
@@ -628,7 +628,7 @@ get_max_paddr(void)
for (i = 0; i < num_pt_loads; i++) {
pls = &pt_loads[i];
- if (max_paddr < pls->phys_end)
+ if (pls->phys_start != NOT_PADDR && max_paddr < pls->phys_end)
max_paddr = pls->phys_end;
}
return max_paddr;
--
2.31.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [MAKEDUMPFILE PATCH] makedumpfile: elf_info: check for invalid physical address when finding max_paddr
2021-06-17 3:28 ` HAGIO KAZUHITO(萩尾 一仁)
@ 2021-06-21 0:46 ` Coiby Xu
0 siblings, 0 replies; 4+ messages in thread
From: Coiby Xu @ 2021-06-21 0:46 UTC (permalink / raw)
To: HAGIO KAZUHITO(萩尾 一仁)
Cc: kexec, Xiaoying Yan
On Thu, Jun 17, 2021 at 03:28:10AM +0000, HAGIO KAZUHITO(萩尾 一仁) wrote:
>-----Original Message-----
>>
>> Kernel commit 464920104bf7adac12722035bfefb3d772eb04d8
>> "/proc/kcore: update physical address for kcore ram and text" sets an
>> invalid paddr (-1=0xffffffffffffffff) for PT_LOAD segments of not direct
>> mapped regions,
>> $ readelf -l /proc/kcore
>>
>> Elf file type is CORE (Core file)
>> Entry point 0x0
>> There are 4 program headers, starting at offset 64
>>
>> Program Headers:
>> Type Offset VirtAddr PhysAddr
>> FileSiz MemSiz Flags Align
>> NOTE 0x0000000000000120 0x0000000000000000 0x0000000000000000
>> 0x0000000000002320 0x0000000000000000 0x0
>> LOAD 0x1000000000010000 0xd000000000000000 0xffffffffffffffff
>> ^^^^^^^^^^^^^^^^^^
>> 0x0001f80000000000 0x0001f80000000000 RWE 0x10000
>> LOAD 0x0000000000010000 0xc000000000000000 0x0000000000000000
>> 0x00000003f0000000 0x00000003f0000000 RWE 0x10000
>> LOAD 0x3000000000010000 0xf000000000000000 0xffffffffffffffff
>> ^^^^^^^^^^^^^^^^^^
>> 0x0000000000fc0000 0x0000000000fc0000 RWE 0x10000
>>
>> makedumple uses max_paddr to calculate the number of sections for sparse
>> memory model thus wrong number is obtained based on max_paddr=-1. This
>> error could lead to the failure of copying /proc/kcore for RHEL-8.5 on
>> ppc64le machine [1],
>> $ uname -r
>> 4.18.0-312.el8.ppc64le
>> $ makedumpfile /proc/kcore vmcore1
>> get_mem_section: Could not validate mem_section.
>> get_mm_sparsemem: Can't get the address of mem_section.
>>
>> makedumpfile Failed.
>
>IIUC, makedumpfile has NOT been developed to filter /proc/kcore so far,
>except for the --mem-usage option, and this is the first patch for it.
>
>It might be more handy than crash's snap.so extension, so I applied this:
>https://github.com/makedumpfile/makedumpfile/commit/38d921a2ef50ebd36258097553626443ffe27496
Thanks for applying the patch!
>
>But please note that maybe filtering /proc/kcore with makedumpfile (and
>also analyzing the dumpfile with crash) is still not mature enough for
>field or production use.
Thanks for the note!
>
>Thanks,
>Kazu
>
>>
>> Let's check if the phys_start of the segment is a valid physical address
>> to fix this problem.
>>
>> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1965267
>>
>> Reported-by: Xiaoying Yan <yiyan@redhat.com>
>> Signed-off-by: Coiby Xu <coxu@redhat.com>
>> ---
>> elf_info.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/elf_info.c b/elf_info.c
>> index e8affb7..9444847 100644
>> --- a/elf_info.c
>> +++ b/elf_info.c
>> @@ -628,7 +628,7 @@ get_max_paddr(void)
>>
>> for (i = 0; i < num_pt_loads; i++) {
>> pls = &pt_loads[i];
>> - if (max_paddr < pls->phys_end)
>> + if (pls->phys_start != NOT_PADDR && max_paddr < pls->phys_end)
>> max_paddr = pls->phys_end;
>> }
>> return max_paddr;
>> --
>> 2.31.1
>>
>>
>> _______________________________________________
>> kexec mailing list
>> kexec@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec
>
--
Best regards,
Coiby
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [MAKEDUMPFILE PATCH] makedumpfile: elf_info: check for invalid physical address when finding max_paddr
2021-06-15 10:26 Coiby Xu
@ 2021-06-17 3:28 ` HAGIO KAZUHITO(萩尾 一仁)
2021-06-21 0:46 ` Coiby Xu
0 siblings, 1 reply; 4+ messages in thread
From: HAGIO KAZUHITO(萩尾 一仁) @ 2021-06-17 3:28 UTC (permalink / raw)
To: Coiby Xu, kexec; +Cc: Xiaoying Yan
-----Original Message-----
>
> Kernel commit 464920104bf7adac12722035bfefb3d772eb04d8
> "/proc/kcore: update physical address for kcore ram and text" sets an
> invalid paddr (-1=0xffffffffffffffff) for PT_LOAD segments of not direct
> mapped regions,
> $ readelf -l /proc/kcore
>
> Elf file type is CORE (Core file)
> Entry point 0x0
> There are 4 program headers, starting at offset 64
>
> Program Headers:
> Type Offset VirtAddr PhysAddr
> FileSiz MemSiz Flags Align
> NOTE 0x0000000000000120 0x0000000000000000 0x0000000000000000
> 0x0000000000002320 0x0000000000000000 0x0
> LOAD 0x1000000000010000 0xd000000000000000 0xffffffffffffffff
> ^^^^^^^^^^^^^^^^^^
> 0x0001f80000000000 0x0001f80000000000 RWE 0x10000
> LOAD 0x0000000000010000 0xc000000000000000 0x0000000000000000
> 0x00000003f0000000 0x00000003f0000000 RWE 0x10000
> LOAD 0x3000000000010000 0xf000000000000000 0xffffffffffffffff
> ^^^^^^^^^^^^^^^^^^
> 0x0000000000fc0000 0x0000000000fc0000 RWE 0x10000
>
> makedumple uses max_paddr to calculate the number of sections for sparse
> memory model thus wrong number is obtained based on max_paddr=-1. This
> error could lead to the failure of copying /proc/kcore for RHEL-8.5 on
> ppc64le machine [1],
> $ uname -r
> 4.18.0-312.el8.ppc64le
> $ makedumpfile /proc/kcore vmcore1
> get_mem_section: Could not validate mem_section.
> get_mm_sparsemem: Can't get the address of mem_section.
>
> makedumpfile Failed.
IIUC, makedumpfile has NOT been developed to filter /proc/kcore so far,
except for the --mem-usage option, and this is the first patch for it.
It might be more handy than crash's snap.so extension, so I applied this:
https://github.com/makedumpfile/makedumpfile/commit/38d921a2ef50ebd36258097553626443ffe27496
But please note that maybe filtering /proc/kcore with makedumpfile (and
also analyzing the dumpfile with crash) is still not mature enough for
field or production use.
Thanks,
Kazu
>
> Let's check if the phys_start of the segment is a valid physical address
> to fix this problem.
>
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1965267
>
> Reported-by: Xiaoying Yan <yiyan@redhat.com>
> Signed-off-by: Coiby Xu <coxu@redhat.com>
> ---
> elf_info.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/elf_info.c b/elf_info.c
> index e8affb7..9444847 100644
> --- a/elf_info.c
> +++ b/elf_info.c
> @@ -628,7 +628,7 @@ get_max_paddr(void)
>
> for (i = 0; i < num_pt_loads; i++) {
> pls = &pt_loads[i];
> - if (max_paddr < pls->phys_end)
> + if (pls->phys_start != NOT_PADDR && max_paddr < pls->phys_end)
> max_paddr = pls->phys_end;
> }
> return max_paddr;
> --
> 2.31.1
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread
* [MAKEDUMPFILE PATCH] makedumpfile: elf_info: check for invalid physical address when finding max_paddr
@ 2021-06-15 10:26 Coiby Xu
2021-06-17 3:28 ` HAGIO KAZUHITO(萩尾 一仁)
0 siblings, 1 reply; 4+ messages in thread
From: Coiby Xu @ 2021-06-15 10:26 UTC (permalink / raw)
To: kexec; +Cc: Xiaoying Yan
Kernel commit 464920104bf7adac12722035bfefb3d772eb04d8
"/proc/kcore: update physical address for kcore ram and text" sets an
invalid paddr (-1=0xffffffffffffffff) for PT_LOAD segments of not direct
mapped regions,
$ readelf -l /proc/kcore
Elf file type is CORE (Core file)
Entry point 0x0
There are 4 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NOTE 0x0000000000000120 0x0000000000000000 0x0000000000000000
0x0000000000002320 0x0000000000000000 0x0
LOAD 0x1000000000010000 0xd000000000000000 0xffffffffffffffff
^^^^^^^^^^^^^^^^^^
0x0001f80000000000 0x0001f80000000000 RWE 0x10000
LOAD 0x0000000000010000 0xc000000000000000 0x0000000000000000
0x00000003f0000000 0x00000003f0000000 RWE 0x10000
LOAD 0x3000000000010000 0xf000000000000000 0xffffffffffffffff
^^^^^^^^^^^^^^^^^^
0x0000000000fc0000 0x0000000000fc0000 RWE 0x10000
makedumple uses max_paddr to calculate the number of sections for sparse
memory model thus wrong number is obtained based on max_paddr=-1. This
error could lead to the failure of copying /proc/kcore for RHEL-8.5 on
ppc64le machine [1],
$ uname -r
4.18.0-312.el8.ppc64le
$ makedumpfile /proc/kcore vmcore1
get_mem_section: Could not validate mem_section.
get_mm_sparsemem: Can't get the address of mem_section.
makedumpfile Failed.
Let's check if the phys_start of the segment is a valid physical address
to fix this problem.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1965267
Reported-by: Xiaoying Yan <yiyan@redhat.com>
Signed-off-by: Coiby Xu <coxu@redhat.com>
---
elf_info.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/elf_info.c b/elf_info.c
index e8affb7..9444847 100644
--- a/elf_info.c
+++ b/elf_info.c
@@ -628,7 +628,7 @@ get_max_paddr(void)
for (i = 0; i < num_pt_loads; i++) {
pls = &pt_loads[i];
- if (max_paddr < pls->phys_end)
+ if (pls->phys_start != NOT_PADDR && max_paddr < pls->phys_end)
max_paddr = pls->phys_end;
}
return max_paddr;
--
2.31.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-21 0:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 10:10 [MAKEDUMPFILE PATCH] makedumpfile: elf_info: check for invalid physical address when finding max_paddr Coiby Xu
2021-06-15 10:26 Coiby Xu
2021-06-17 3:28 ` HAGIO KAZUHITO(萩尾 一仁)
2021-06-21 0:46 ` Coiby Xu
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.