Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1671215

Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time

From Randy Dunlap <rdunlap@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time
Date 2017-06-21 01:20 +0200
Message-ID <tUABb-6zP-3@gated-at.bofh.it> (permalink)
References <tUArv-6wp-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 06/20/2017 04:09 PM, Kees Cook wrote:
> Some hardened environments want to build kernels with slab_nomerge
> already set (so that they do not depend on remembering to set the kernel
> command line option). This is desired to reduce the risk of kernel heap
> overflows being able to overwrite objects from merged caches and changes
> the requirements for cache layout control, increasing the difficulty of
> these attacks. By keeping caches unmerged, these kinds of exploits can
> usually only damage objects in the same cache (though the risk to metadata
> exploitation is unchanged).
> 
> Cc: Daniel Micay <danielmicay@gmail.com>
> Cc: David Windsor <dave@nullcore.net>
> Cc: Eric Biggers <ebiggers3@gmail.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> v2: split out of slab whitelisting series
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 10 ++++++++--
>  init/Kconfig                                    | 14 ++++++++++++++
>  mm/slab_common.c                                |  5 ++---
>  3 files changed, 24 insertions(+), 5 deletions(-)

> diff --git a/init/Kconfig b/init/Kconfig
> index 1d3475fc9496..ce813acf2f4f 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1891,6 +1891,20 @@ config SLOB
>  
>  endchoice
>  
> +config SLAB_MERGE_DEFAULT
> +	bool "Allow slab caches to be merged"
> +	default y
> +	help
> +	  For reduced kernel memory fragmentation, slab caches can be
> +	  merged when they share the same size and other characteristics.
> +	  This carries a risk of kernel heap overflows being able to
> +	  overwrite objects from merged caches (and more easily control
> +	  cache layout), which makes such heap attacks easier to exploit
> +	  by attackers. By keeping caches unmerged, these kinds of exploits
> +	  can usually only damage objects in the same cache. To disable
> +	  merging at runtime, "slab_nomerge" can be passed on the kernel
> +	  command line.

          command line or this option can be disabled in the kernel config.

> +
>  config SLAB_FREELIST_RANDOM
>  	default n
>  	depends on SLAB || SLUB

-- 
~Randy

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] mm: Allow slab_nomerge to be set at build time Kees Cook <keescook@chromium.org> - 2017-06-21 01:10 +0200
  Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time Randy Dunlap <rdunlap@infradead.org> - 2017-06-21 01:20 +0200
    Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time Kees Cook <keescook@chromium.org> - 2017-06-21 01:30 +0200
      Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time Randy Dunlap <rdunlap@infradead.org> - 2017-06-21 02:10 +0200
  Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time Michal Hocko <mhocko@kernel.org> - 2017-06-23 16:10 +0200
    Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time Kees Cook <keescook@chromium.org> - 2017-06-23 21:30 +0200
      Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time Michal Hocko <mhocko@kernel.org> - 2017-06-26 11:10 +0200

csiph-web