All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: Kees Cook <keescook@chromium.org>
Cc: Ingo Molnar <mingo@kernel.org>, Baoquan He <bhe@redhat.com>,
	Yinghai Lu <yinghai@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, Andrew Morton <akpm@linux-foundation.org>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	"H.J. Lu" <hjl.tools@gmail.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] x86, KASLR: Drop CONFIG_RANDOMIZE_BASE_MAX_OFFSET
Date: Thu, 21 Apr 2016 19:44:23 +0200	[thread overview]
Message-ID: <20160421174423.GD29616@pd.tnic> (raw)
In-Reply-To: <1461185746-8017-3-git-send-email-keescook@chromium.org>

On Wed, Apr 20, 2016 at 01:55:43PM -0700, Kees Cook wrote:
> From: Baoquan He <bhe@redhat.com>
> 
> Currently CONFIG_RANDOMIZE_BASE_MAX_OFFSET is used to limit the maximum
> offset for kernel randomization. This limit doesn't need to be a CONFIG
> since it is tied completely to KERNEL_IMAGE_SIZE, and will make no sense
> once physical and virtual offsets are randomized separately. This patch
> removes CONFIG_RANDOMIZE_BASE_MAX_OFFSET and consolidates the Kconfig
> help text.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> [kees: rewrote changelog, dropped KERNEL_IMAGE_SIZE_DEFAULT, rewrote help]
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/x86/Kconfig                     | 72 ++++++++++++++----------------------
>  arch/x86/boot/compressed/kaslr.c     | 12 +++---
>  arch/x86/include/asm/page_64_types.h |  8 ++--
>  arch/x86/mm/init_32.c                |  3 --
>  4 files changed, 36 insertions(+), 59 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 2dc18605831f..5892d549596d 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -1932,54 +1932,38 @@ config RELOCATABLE
>  	  (CONFIG_PHYSICAL_START) is used as the minimum location.
>  
>  config RANDOMIZE_BASE
> -	bool "Randomize the address of the kernel image"
> +	bool "Randomize the address of the kernel image (KASLR)"
>  	depends on RELOCATABLE
>  	default n
>  	---help---
> -	   Randomizes the physical and virtual address at which the
> -	   kernel image is decompressed, as a security feature that
> -	   deters exploit attempts relying on knowledge of the location
> -	   of kernel internals.
> +	  In support of Kernel Address Space Layout Randomization (KASLR),
> +	  this randomizes the physical address at which the kernel image
> +	  is decompressed and the virtual address where the kernel

Just say "loaded" here.

> +	  image is mapped, as a security feature that deters exploit
> +	  attempts relying on knowledge of the location of kernel
> +	  code internals.
> +
> +	  The kernel physical and virtual address can be randomized
> +	  from 16MB up to 1GB on 64-bit and 512MB on 32-bit. (Note that
> +	  using RANDOMIZE_BASE reduces the memory space available to
> +	  kernel modules from 1.5GB to 1GB.)
> +
> +	  Entropy is generated using the RDRAND instruction if it is
> +	  supported. If RDTSC is supported, its value is mixed into
> +	  the entropy pool as well. If neither RDRAND nor RDTSC are
> +	  supported, then entropy is read from the i8254 timer.
> +
> +	  Since the kernel is built using 2GB addressing,

Does that try to refer to the 1G kernel and 1G fixmap pagetable
mappings? I.e., level2_kernel_pgt and level2_fixmap_pgt in
arch/x86/kernel/head_64.S?

> and
> +	  PHYSICAL_ALIGN must be at a minimum of 2MB, only 10 bits of
> +	  entropy is theoretically possible. Currently, with the
> +	  default value for PHYSICAL_ALIGN and due to page table
> +	  layouts, 64-bit uses 9 bits of entropy and 32-bit uses 8 bits.
> +
> +	  If CONFIG_HIBERNATE is also enabled, KASLR is disabled at boot
> +	  time. To enable it, boot with "kaslr" on the kernel command
> +	  line (which will also disable hibernation).

...

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

  reply	other threads:[~2016-04-21 17:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20 20:55 [PATCH 0/5] x86, boot: clean up KASLR code (step 2) Kees Cook
2016-04-20 20:55 ` [PATCH 1/5] x86, KASLR: Update description for decompressor worst case size Kees Cook
2016-04-21 14:47   ` Borislav Petkov
2016-04-21 20:04     ` Kees Cook
2016-04-22  3:13       ` Baoquan He
2016-04-22  7:41   ` Ingo Molnar
2016-04-22  9:45   ` [tip:x86/boot] x86/KASLR: " tip-bot for Baoquan He
2016-04-20 20:55 ` [PATCH 2/5] x86, KASLR: Drop CONFIG_RANDOMIZE_BASE_MAX_OFFSET Kees Cook
2016-04-21 17:44   ` Borislav Petkov [this message]
2016-04-21 18:13     ` Kees Cook
2016-04-22  7:16       ` Ingo Molnar
2016-04-22  9:43         ` Borislav Petkov
2016-04-22  9:45   ` [tip:x86/boot] x86/KASLR: " tip-bot for Baoquan He
2016-04-20 20:55 ` [PATCH 3/5] x86, boot: Clean up things used by decompressors Kees Cook
2016-04-22  9:46   ` [tip:x86/boot] x86/boot: " tip-bot for Kees Cook
2016-04-20 20:55 ` [PATCH 4/5] x86, boot: Make memcpy handle overlaps Kees Cook
2016-04-22  7:49   ` Ingo Molnar
2016-04-22 22:18     ` Kees Cook
2016-04-22  7:56   ` Ingo Molnar
2016-04-22  9:46   ` [tip:x86/boot] x86/boot: Make memcpy() " tip-bot for Kees Cook
2016-04-22 21:05     ` Lasse Collin
2016-04-22 22:01       ` Kees Cook
2016-04-20 20:55 ` [PATCH 5/5] x86, KASLR: Warn when KASLR is disabled Kees Cook
2016-04-22  9:47   ` [tip:x86/boot] x86/KASLR: " tip-bot for Kees Cook
2016-04-22  7:43 ` [PATCH 0/5] x86, boot: clean up KASLR code (step 2) Ingo Molnar
2016-04-22 15:39   ` Kees Cook

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=20160421174423.GD29616@pd.tnic \
    --to=bp@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=bhe@redhat.com \
    --cc=dvyukov@google.com \
    --cc=hjl.tools@gmail.com \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=x86@kernel.org \
    --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.