summaryrefslogtreecommitdiff
path: root/mm/slub.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2024-04-25 13:55:23 -0700
committerAndrew Morton <akpm@linux-foundation.org>2024-04-25 20:55:59 -0700
commit3b89ec41747a6b6b8c7b6ad4fe13e063cb6dfe7f (patch)
tree8291b6ce6f0148529c12d8b5118c250a1005e4c6 /mm/slub.c
parente13106952faad91c6e492bf23b7cbdf1b1c269ce (diff)
downloadlwn-3b89ec41747a6b6b8c7b6ad4fe13e063cb6dfe7f.tar.gz
lwn-3b89ec41747a6b6b8c7b6ad4fe13e063cb6dfe7f.zip
mm/slub: avoid recursive loop with kmemleak
The system will immediate fill up stack and crash when both CONFIG_DEBUG_KMEMLEAK and CONFIG_MEM_ALLOC_PROFILING are enabled. Avoid allocation tagging of kmemleak caches, otherwise recursive allocation tracking occurs. Link: https://lkml.kernel.org/r/20240425205516.work.220-kees@kernel.org Fixes: 279bb991b4d9 ("mm/slab: add allocation accounting into slab allocation and free paths") Signed-off-by: Kees Cook <keescook@chromium.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christoph Lameter <cl@linux.com> Cc: David Rientjes <rientjes@google.com> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Kent Overstreet <kent.overstreet@linux.dev> Cc: Pekka Enberg <penberg@kernel.org> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/slub.c b/mm/slub.c
index be047279c9e9..6437746be03d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2018,7 +2018,7 @@ prepare_slab_obj_exts_hook(struct kmem_cache *s, gfp_t flags, void *p)
if (!p)
return NULL;
- if (s->flags & SLAB_NO_OBJ_EXT)
+ if (s->flags & (SLAB_NO_OBJ_EXT | SLAB_NOLEAKTRACE))
return NULL;
if (flags & __GFP_NO_OBJ_EXT)