From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d8IHo-0005pW-CD for kexec@lists.infradead.org; Wed, 10 May 2017 03:27:38 +0000 Subject: Re: [Makedumpfile PATCH V2] elf_info: fix file_size if segment is excluded References: <6edcc4dfcd9ed60265a5fde658ad2db4c4f28cad.1494337896.git.panand@redhat.com> From: Xunlei Pang Message-ID: <591288E6.7090401@redhat.com> Date: Wed, 10 May 2017 11:28:38 +0800 MIME-Version: 1.0 In-Reply-To: <6edcc4dfcd9ed60265a5fde658ad2db4c4f28cad.1494337896.git.panand@redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: xlpang@redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Pratyush Anand , ats-kumagai@wm.jp.nec.com Cc: kexec@lists.infradead.org, dyoung@redhat.com, bhe@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 > --- > 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