From: Xunlei Pang <xpang@redhat.com>
To: Pratyush Anand <panand@redhat.com>, ats-kumagai@wm.jp.nec.com
Cc: kexec@lists.infradead.org, dyoung@redhat.com, bhe@redhat.com
Subject: Re: [Makedumpfile PATCH V2] elf_info: fix file_size if segment is excluded
Date: Wed, 10 May 2017 11:28:38 +0800 [thread overview]
Message-ID: <591288E6.7090401@redhat.com> (raw)
In-Reply-To: <6edcc4dfcd9ed60265a5fde658ad2db4c4f28cad.1494337896.git.panand@redhat.com>
On 05/09/2017 at 09:53 PM, Pratyush Anand wrote:
> I received following on a specific x86_64 hp virtual machine while
> executing `makedumpfile --mem-usage /proc/kcore`.
>
> vtop4_x86_64: Can't get a valid pte.
> readmem: Can't convert a virtual address(ffffffff88115860) to physical address.
> readmem: type_addr: 0, addr:ffffffff88115860, size:128
> get_nodes_online: Can't get the node online map.
>
> With some debug print in vtop4_x86_64() I noticed that pte value is read
> as 0, while crash reads the value correctly:
>
> from makedumpfile:
> vaddr=ffffffff88115860
> page_dir=59eaff8
> pml4=59ed067
> pgd_paddr=59edff0
> pgd_pte=59ee063
> pmd_paddr=59ee200
> pmd_pte=3642f063
> pte_paddr=3642f8a8
> pte=0
>
> from crash
> crash> vtop ffffffff88115860
> VIRTUAL PHYSICAL
> ffffffff88115860 5b15860
>
> PML4 DIRECTORY: ffffffff87fea000
> PAGE DIRECTORY: 59ed067
> PUD: 59edff0 => 59ee063
> PMD: 59ee200 => 3642f063
> PTE: 3642f8a8 => 5b15163
> PAGE: 5b15000
>
> With some more debug prints in elf_info.c
>
> Before calling exclude_segment()
>
> LOAD (2)
> phys_start : 100000
> phys_end : dfffd000
> virt_start : ffff8a5a40100000
> virt_end : ffff8a5b1fffd000
> file_offset: a5a40102000
> file_size : dfefd000
>
> exclude_segment() is called for Crash Kernel whose range is
> 2b000000-350fffff.
>
> We see following after exclude_segment()
>
> LOAD (2)
> phys_start : 100000
> phys_end : 2affffff
> virt_start : ffff8a5a40100000
> virt_end : ffff8a5a6affffff
> file_offset: a5a40102000
> file_size : dfefd000
> LOAD (3)
> phys_start : 35100000
> phys_end : dfffd000
> virt_start : ffff8a5a75100000
> virt_end : ffff8a5b1fffd000
> file_offset: a5a75102000
> file_size : 0
>
> Since file_size is calculated wrong therefore readpage_elf() does not
> behave correctly.
>
> This patch fixes above wrong behavior.
>
> Signed-off-by: Pratyush Anand <panand@redhat.com>
> ---
> v1->v2 : subtracted (end - start) from file_size as well
>
> elf_info.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/elf_info.c b/elf_info.c
> index 8e2437622141..5494c4dcbebe 100644
> --- a/elf_info.c
> +++ b/elf_info.c
> @@ -826,9 +826,13 @@ static int exclude_segment(struct pt_load_segment **pt_loads,
> temp_seg.virt_end = vend;
> temp_seg.file_offset = (*pt_loads)[i].file_offset
> + temp_seg.virt_start - (*pt_loads)[i].virt_start;
> + temp_seg.file_size = temp_seg.phys_end
> + - temp_seg.phys_start;
>
> (*pt_loads)[i].virt_end = kvstart - 1;
> (*pt_loads)[i].phys_end = start - 1;
> + (*pt_loads)[i].file_size -= (temp_seg.file_size
> + + end - start);
Hi Pratyush,
Don't we need to move the "(*pt_loads)[i].file_size" minus "(end - start)" down
to the tail of "if (kvstart < vend && kvend > vstart)" condition for all cases?
Regards,
Xunlei
>
> tidx = i+1;
> } else if (kvstart != vstart) {
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2017-05-10 3:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 13:53 [Makedumpfile PATCH V2] elf_info: fix file_size if segment is excluded Pratyush Anand
2017-05-10 3:28 ` Xunlei Pang [this message]
2017-05-10 4:43 ` Pratyush Anand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=591288E6.7090401@redhat.com \
--to=xpang@redhat.com \
--cc=ats-kumagai@wm.jp.nec.com \
--cc=bhe@redhat.com \
--cc=dyoung@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=panand@redhat.com \
--cc=xlpang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.