From: Dave Young <dyoung@redhat.com>
To: Pratyush Anand <panand@redhat.com>
Cc: kexec@lists.infradead.org, anderson@redhat.com,
linux-kernel@vger.kernel.org, bhe@redhat.com
Subject: Re: [PATCH] /proc/kcore: Update physical address for kcore ram and text
Date: Wed, 25 Jan 2017 14:29:49 +0800 [thread overview]
Message-ID: <20170125062949.GA3423@dhcp-128-65.nay.redhat.com> (raw)
In-Reply-To: <f951340d2917cdd2a329fae9837a83f2059dc3b2.1485318868.git.panand@redhat.com>
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 <panand@redhat.com>
> ---
> 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
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2017-01-25 6:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 4:44 [PATCH] /proc/kcore: Update physical address for kcore ram and text Pratyush Anand
2017-01-25 6:29 ` Dave Young [this message]
2017-01-25 6:51 ` Pratyush Anand
[not found] ` <CAHB_GupwpXiZjmy+4SQLvoJaJkAo9VvNVxQgxqvXeACRR--exg@mail.gmail.com>
2017-02-13 22:25 ` Kees Cook
2017-02-14 1:46 ` Pratyush Anand
2017-02-24 7:20 ` Pratyush Anand
2017-02-24 7:39 ` Baoquan He
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=20170125062949.GA3423@dhcp-128-65.nay.redhat.com \
--to=dyoung@redhat.com \
--cc=anderson@redhat.com \
--cc=bhe@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=panand@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox