[Devel] [PATCH RHEL7 COMMIT] mm, slub, kasan: enable user tracking by default.

Vladimir Davydov vdavydov at virtuozzo.com
Tue Sep 8 08:30:57 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.8
------>
commit 7914b7f933e9d9514f02034b9661007e10bfbb1c
Author: Andrey Ryabinin <aryabinin at odin.com>
Date:   Tue Sep 8 19:30:57 2015 +0400

    mm, slub, kasan: enable user tracking by default.
    
    It's recomended to have slub's user tracking enabled with CONFIG_KASAN:
    a) User tracking disables slab merging which improves
        detecting out-of-bounds accesses.
    b) User tracking metadata acts as redzone which also improves
        detecting out-of-bounds accesses.
    c) User tracking provides additional information about object.
        This information helps to understand bugs.
    
    However, currently this not enabled by default, user have to put
    additional parameter in boot cmdline in order to enable this option.
    This is bad, because it requires to keep different cmdlines for
    release and debug kernels.
    So we should enable this by default.
    
    https://jira.sw.ru/browse/PSBM-39339
    
    Signed-off-by: Andrey Ryabinin <aryabinin at odin.com>
    Reviewed-by: Vladimir Davydov <vdavydov at parallels.com>
---
 Documentation/kasan.txt | 3 +--
 mm/slub.c               | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/kasan.txt b/Documentation/kasan.txt
index 092fc10961fe..ee36ef1a64c0 100644
--- a/Documentation/kasan.txt
+++ b/Documentation/kasan.txt
@@ -27,8 +27,7 @@ latter is 1.1 - 2 times faster. Inline instrumentation requires GCC 5.0 or
 latter.
 
 Currently KASAN works only with the SLUB memory allocator.
-For better bug detection and nicer report, enable CONFIG_STACKTRACE and put
-at least 'slub_debug=U' in the boot cmdline.
+For better bug detection and nicer report and enable CONFIG_STACKTRACE.
 
 To disable instrumentation for specific files or directories, add a line
 similar to the following to the respective kernel Makefile:
diff --git a/mm/slub.c b/mm/slub.c
index 37c103b90a64..2f07a632af1d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -457,6 +457,8 @@ static void get_map(struct kmem_cache *s, struct page *page, unsigned long *map)
  */
 #ifdef CONFIG_SLUB_DEBUG_ON
 static int slub_debug = DEBUG_DEFAULT_FLAGS;
+#elif defined (CONFIG_KASAN)
+static int slub_debug = SLAB_STORE_USER;
 #else
 static int slub_debug;
 #endif



More information about the Devel mailing list