From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751292AbdAYG35 (ORCPT ); Wed, 25 Jan 2017 01:29:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46496 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751246AbdAYG34 (ORCPT ); Wed, 25 Jan 2017 01:29:56 -0500 Date: Wed, 25 Jan 2017 14:29:49 +0800 From: Dave Young To: Pratyush Anand Cc: linux-kernel@vger.kernel.org, bhe@redhat.com, anderson@redhat.com, kexec@lists.infradead.org Subject: Re: [PATCH] /proc/kcore: Update physical address for kcore ram and text Message-ID: <20170125062949.GA3423@dhcp-128-65.nay.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 25 Jan 2017 06:29:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pratyush On 01/25/17 at 10:14am, Pratyush Anand wrote: > Currently all the p_paddr of PT_LOAD headers are assigned to 0, which is > not true and could be misleading, since 0 is a valid physical address. I do not know the history of /proc/kcore, so a question is why the p_addr was set as 0, if there were some reasons and if this could cause some risk or breakage. > > User space tools like makedumpfile needs to know physical address for > PT_LOAD segments of direct mapped regions. Therefore this patch updates > paddr for such regions. It also sets an invalid paddr (-1) for other > regions, so that user space tool can know whether a physical address > provided in PT_LOAD is correct or not. > > Signed-off-by: Pratyush Anand > --- > fs/proc/kcore.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c > index 0b80ad87b4d6..ea9f3d1ae830 100644 > --- a/fs/proc/kcore.c > +++ b/fs/proc/kcore.c > @@ -373,7 +373,10 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff) > phdr->p_flags = PF_R|PF_W|PF_X; > phdr->p_offset = kc_vaddr_to_offset(m->addr) + dataoff; > phdr->p_vaddr = (size_t)m->addr; > - phdr->p_paddr = 0; > + if (m->type == KCORE_RAM || m->type == KCORE_TEXT) > + phdr->p_paddr = __pa(m->addr); > + else > + phdr->p_paddr = (elf_addr_t)-1; > phdr->p_filesz = phdr->p_memsz = m->size; > phdr->p_align = PAGE_SIZE; > } > -- > 2.9.3 > Thanks Dave