linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Christoph Lameter <cl@linux.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Daniel Micay <danielmicay@gmail.com>,
	David Windsor <dave@nullcore.net>,
	Eric Biggers <ebiggers3@gmail.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Arnd Bergmann <arnd@arndb.de>, Andy Lutomirski <luto@kernel.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Tejun Heo <tj@kernel.org>, Daniel Mack <daniel@zonque.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Helge Deller <deller@gmx.de>, Rik van Riel <riel@redhat.com>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] mm: Allow slab_nomerge to be set at build time
Date: Tue, 20 Jun 2017 16:29:15 -0700	[thread overview]
Message-ID: <CAGXu5jLUqqg-aAD6mGs613GCH6H443+3VU9OfCca+=Lf+Z9j9g@mail.gmail.com> (raw)
In-Reply-To: <1eb1cfff-14f0-8fa9-1b48-679865339646@infradead.org>

On Tue, Jun 20, 2017 at 4:16 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
> 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.

Isn't that implicit in that it is Kconfig help text? Happy to add it,
but seems redundant to me.

-Kees

>
>> +
>>  config SLAB_FREELIST_RANDOM
>>       default n
>>       depends on SLAB || SLUB
>
> --
> ~Randy



-- 
Kees Cook
Pixel Security

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-06-20 23:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 23:09 [PATCH v2] mm: Allow slab_nomerge to be set at build time Kees Cook
2017-06-20 23:16 ` Randy Dunlap
2017-06-20 23:29   ` Kees Cook [this message]
2017-06-21  0:09     ` Randy Dunlap
2017-06-23 14:06 ` Michal Hocko
2017-06-23 19:20   ` Kees Cook
2017-06-26  9:00     ` Michal Hocko

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='CAGXu5jLUqqg-aAD6mGs613GCH6H443+3VU9OfCca+=Lf+Z9j9g@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=bigeasy@linutronix.de \
    --cc=cl@linux.com \
    --cc=corbet@lwn.net \
    --cc=daniel@zonque.org \
    --cc=danielmicay@gmail.com \
    --cc=dave@nullcore.net \
    --cc=deller@gmx.de \
    --cc=ebiggers3@gmail.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mingo@kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=penberg@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rdunlap@infradead.org \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).