Commit e7cb55b9 authored by Catalin Marinas's avatar Catalin Marinas

kmemleak: Do not use off-slab management with SLAB_NOLEAKTRACE

With the slab allocator, if off-slab management is enabled for the
kmem_caches used by kmemleak, it leads to recursive calls into
kmemleak_alloc(). Off-slab management can be triggered by other config
options increasing the slab size, e.g. DEBUG_PAGEALLOC.
Reported-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 012abeea
...@@ -2261,9 +2261,11 @@ kmem_cache_create (const char *name, size_t size, size_t align, ...@@ -2261,9 +2261,11 @@ kmem_cache_create (const char *name, size_t size, size_t align,
/* /*
* Determine if the slab management is 'on' or 'off' slab. * Determine if the slab management is 'on' or 'off' slab.
* (bootstrapping cannot cope with offslab caches so don't do * (bootstrapping cannot cope with offslab caches so don't do
* it too early on.) * it too early on. Always use on-slab management when
* SLAB_NOLEAKTRACE to avoid recursive calls into kmemleak)
*/ */
if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init) if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init &&
!(flags & SLAB_NOLEAKTRACE))
/* /*
* Size is large, assume best to place the slab management obj * Size is large, assume best to place the slab management obj
* off-slab (should allow better packing of objs). * off-slab (should allow better packing of objs).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment