All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Dave Anderson <anderson@redhat.com>
Cc: Kees Cook <keescook@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, Yinghai Lu <yinghai@kernel.org>,
	Borislav Petkov <bp@suse.de>,
	Thomas Garnier <thgarnie@google.com>,
	Alexander Kuleshov <kuleshovmail@gmail.com>,
	Andy Lutomirski <luto@kernel.org>, Dave Young <dyoung@redhat.com>,
	Xunlei Pang <xlpang@redhat.com>
Subject: Re: [PATCH 0/2] Determine kernel text mapping size at runtime for x86_64
Date: Sat, 10 Dec 2016 09:32:23 +0800	[thread overview]
Message-ID: <20161210013223.GB1034@x1> (raw)
In-Reply-To: <1018201061.5338919.1481223604680.JavaMail.zimbra@redhat.com>

On 12/08/16 at 02:00pm, Dave Anderson wrote:
> 
> 
> ----- Original Message -----
> > On Wed, Dec 7, 2016 at 11:56 PM, Baoquan He <bhe@redhat.com> wrote:
> > > Dave Anderson ever told in Crash utility he makes judgement whether it's
> > > a kaslr kernel by size of KERNEL_IMAGE_SIZE. As long as it's 1G, it's
> > > recognized as kaslr. Then the current upstream kernel has a wrong behaviour,
> > > it sets KERNEL_IMAGE_SIZE as 1G as long as CONFIG_RANDOMIZE_BASE is enabled,
> > > though people specify "nokaslr" into cmdline to disable kaslr explicitly.
> > 
> > I'm not sure that's the correct solution to the Crash utility -- the
> > kaslr-ness of a kernel should be already exposed in the dump with the
> > kaslr_enabled variable yes?
> 
> The crash utility doesn't use KERNEL_IMAGE_SIZE to determine whether
> KASLR is in play, but rather to determine the base of the modules virtual
> address space (i.e, the same way the kernel does).  And then it uses that
> value in a couple other places.

Then I got it wrong.

The current code makes it the same:

#define MODULES_VADDR    (__START_KERNEL_map + KERNEL_IMAGE_SIZE)

With change, Crash doesn't need to change.

Thanks
Baoquan

> 
> 
> > 
> > > So in this patchset, made changes to determine the size of kernel text
> > > mapping
> > > area at runtime. If "nokaslr" specified, kernel mapping size is 512M though
> > > CONFIG_RANDOMIZE_BASE is enabled.
> > 
> > This seems to make the non-KASLR case more consistent, so I'm fine
> > with the idea. Once the build-bots are happy with everything, consider
> > the series:
> > 
> > Acked-by: Kees Cook <keescook@chromium.org>
> > 
> > Thanks!
> > 
> > -Kees
> > 
> > >
> > > Baoquan He (2):
> > >   x86/64: Make kernel text mapping always take one whole page table in
> > >     early boot code
> > >   x86/KASLR/64: Determine kernel text mapping size at runtime
> > >
> > >  arch/x86/boot/compressed/kaslr.c        | 15 ++++++++++-----
> > >  arch/x86/include/asm/kaslr.h            |  1 +
> > >  arch/x86/include/asm/page_64_types.h    | 20 ++++++++++++--------
> > >  arch/x86/include/asm/pgtable_64_types.h |  2 +-
> > >  arch/x86/kernel/head64.c                | 11 ++++++-----
> > >  arch/x86/kernel/head_64.S               | 16 +++++++++-------
> > >  arch/x86/mm/dump_pagetables.c           |  3 ++-
> > >  arch/x86/mm/init_64.c                   |  2 +-
> > >  arch/x86/mm/physaddr.c                  |  6 +++---
> > >  9 files changed, 45 insertions(+), 31 deletions(-)
> > >
> > > --
> > > 2.5.5
> > >
> > 
> > 
> > 
> > --
> > Kees Cook
> > Nexus Security
> > 

      reply	other threads:[~2016-12-10  1:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08  7:56 [PATCH 0/2] Determine kernel text mapping size at runtime for x86_64 Baoquan He
2016-12-08  7:56 ` [PATCH 1/2] x86/64: Make kernel text mapping always take one whole page table in early boot code Baoquan He
2016-12-08  8:24   ` Alexnader Kuleshov
2016-12-08  8:40     ` Baoquan He
2016-12-08  7:56 ` [PATCH 2/2] x86/KASLR/64: Determine kernel text mapping size at runtime Baoquan He
2016-12-08  8:17   ` Alexnader Kuleshov
2016-12-08  8:25     ` Baoquan He
2016-12-08  9:41   ` kbuild test robot
2016-12-08 13:41     ` Baoquan He
2016-12-08  9:41   ` kbuild test robot
2016-12-08 18:31 ` [PATCH 0/2] Determine kernel text mapping size at runtime for x86_64 Kees Cook
2016-12-08 19:00   ` Dave Anderson
2016-12-10  1:32     ` Baoquan He [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=20161210013223.GB1034@x1 \
    --to=bhe@redhat.com \
    --cc=anderson@redhat.com \
    --cc=bp@suse.de \
    --cc=dyoung@redhat.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kuleshovmail@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thgarnie@google.com \
    --cc=x86@kernel.org \
    --cc=xlpang@redhat.com \
    --cc=yinghai@kernel.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.