summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-07-06 18:36:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-06 19:24:31 -0400
commit7660a6fddcbae344de8583aa4092071312f110c3 (patch)
treecf87d66431e544a85cd754cd5b54e2db68d25b13 /init
parente07719502916a675023d9d31b9fd4370c7413b68 (diff)
mm: allow slab_nomerge to be set at build time
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). Link: http://lkml.kernel.org/r/20170620230911.GA25238@beast Signed-off-by: Kees Cook <keescook@chromium.org> Cc: Daniel Micay <danielmicay@gmail.com> Cc: David Windsor <dave@nullcore.net> Cc: Eric Biggers <ebiggers3@gmail.com> Cc: Christoph Lameter <cl@linux.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Daniel Micay <danielmicay@gmail.com> Cc: David Windsor <dave@nullcore.net> Cc: Eric Biggers <ebiggers3@gmail.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Nicolas Pitre <nicolas.pitre@linaro.org> Cc: Tejun Heo <tj@kernel.org> Cc: Daniel Mack <daniel@zonque.org> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Helge Deller <deller@gmx.de> Cc: Rik van Riel <riel@redhat.com> Cc: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig14
1 files changed, 14 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig
index b0fcbb2c6f56..8514b25db21c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1548,6 +1548,20 @@ config SLOB
1548 1548
1549endchoice 1549endchoice
1550 1550
1551config SLAB_MERGE_DEFAULT
1552 bool "Allow slab caches to be merged"
1553 default y
1554 help
1555 For reduced kernel memory fragmentation, slab caches can be
1556 merged when they share the same size and other characteristics.
1557 This carries a risk of kernel heap overflows being able to
1558 overwrite objects from merged caches (and more easily control
1559 cache layout), which makes such heap attacks easier to exploit
1560 by attackers. By keeping caches unmerged, these kinds of exploits
1561 can usually only damage objects in the same cache. To disable
1562 merging at runtime, "slab_nomerge" can be passed on the kernel
1563 command line.
1564
1551config SLAB_FREELIST_RANDOM 1565config SLAB_FREELIST_RANDOM
1552 default n 1566 default n
1553 depends on SLAB || SLUB 1567 depends on SLAB || SLUB