All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: WANG Chao <chaowang@redhat.com>
Cc: dyoung@redhat.com, Simon Horman <horms@verge.net.au>,
	kexec@lists.infradead.org, ebiederm@xmission.com
Subject: Re: [PATCH v2] x86, kaslr: Kernel base can be randomized at 0-1G offset.
Date: Thu, 20 Mar 2014 11:18:22 -0400	[thread overview]
Message-ID: <20140320151822.GA29549@redhat.com> (raw)
In-Reply-To: <20140320054608.GA25772@dhcp-17-89.nay.redhat.com>

On Thu, Mar 20, 2014 at 01:46:08PM +0800, WANG Chao wrote:
> [CC Simon]
> 
> On 03/19/14 at 09:33am, Vivek Goyal wrote:
> > On Wed, Mar 19, 2014 at 03:05:51PM +0800, WANG Chao wrote:
> > > On 03/17/14 at 08:56am, Vivek Goyal wrote:
> > > > On Fri, Mar 14, 2014 at 04:20:18PM +0800, WANG Chao wrote:
> > > > > With kASLR enabled (CONFIG_RANDOMIZED_BASE=y), kernel virtual address
> > > > > base is PAGE_OFFSET plus a randomized offset from 0 to 1G.
> > > > > 
> > > > > Current kexec-tools gets kernel vaddr and size from /proc/kcore. It
> > > > > assumes kernel vaddr start/end is within the range [0,512M). If kaslr
> > > > > enabled, kernel vaddr start/end will stay at [0+offset, 512M+offset).
> > > 
> > > NACK this patch myself.
> > > 
> > > There are several mistakes I made. I misunderstood some concepts. Then I
> > > realize this kASLR issue is not trivial to fix.
> > > 
> > > I think if kexec-tools needs to get kernel text mapping from kcore in
> > > kALSR case, the max base offset (CONFIG_RANDOMIZE_MAX_BASE_OFFSET) of
> > > the kernel text area must be exposed to userspace some where. We can use
> > > that value to determine which area is for kernel text mapping and which
> > > is for modules text mapping.
> > 
> > How about looking at /proc/kallsyms and look at address of one of the
> > symbols say _text. And search for the ELF header in kcore which contains
> > _text address and that's ELF header representing kernel text mapping.
> 
> Cool. I'd like to go with _stext. _text presents in /proc/kallsyms only
> when CONFIG_KALLSYMS_ALL=y. What do you think?

That's fine. Though looks like _stext will also work only if
CONFIG_KALLSYMS=y.  So that's not a perfect solution either for those
who have built kernel using CONFIG_KALLSYMS=n.

Thanks
Vivek

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

      reply	other threads:[~2014-03-20 15:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  8:20 [PATCH v2] x86, kaslr: Kernel base can be randomized at 0-1G offset WANG Chao
2014-03-17  3:27 ` Dave Young
2014-03-17 12:56 ` Vivek Goyal
2014-03-19  7:05   ` WANG Chao
2014-03-19 13:33     ` Vivek Goyal
2014-03-20  5:46       ` WANG Chao
2014-03-20 15:18         ` Vivek Goyal [this message]

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=20140320151822.GA29549@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=chaowang@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    /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.