Skip to contentSkip to conversation

mm-slub-avoid-recursive-loop-with-kmemleak.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 26, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/slub: avoid recursive loop with kmemleak
has been removed from the -mm tree. Its filename was
mm-slub-avoid-recursive-loop-with-kmemleak.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Kees Cook <[email protected]>
Subject: mm/slub: avoid recursive loop with kmemleak
Date: Thu, 25 Apr 2024 13:55:23 -0700

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.

Fixes 279bb991b4d9 ("mm/slab: add allocation accounting into slab allocation and free paths")
Cc Catalin Marinas <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc David Rientjes <[email protected]>
Cc Hyeonggon Yoo <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Kent Overstreet <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Roman Gushchin <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 mm/kmemleak.c |    4 ++--
 mm/slub.c     |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
mm/kmemleak.c renamed from mm/kmemleak.c~mm-slub-avoid-recursive-loop-with-kmemleak +2 -2
@@ -463,7 +463,7 @@ static struct kmemleak_object *mem_pool_
 
 	/* try the slab allocator first */
 	if (object_cache) {
-		object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp));
+		object = kmem_cache_alloc_noprof(object_cache, gfp_kmemleak_mask(gfp));
 		if (object)
 			return object;
 	}
@@ -947,7 +947,7 @@ static void add_scan_area(unsigned long
 	untagged_objp = (unsigned long)kasan_reset_tag((void *)object->pointer);
 
 	if (scan_area_cache)
-		area = kmem_cache_alloc(scan_area_cache, gfp_kmemleak_mask(gfp));
+		area = kmem_cache_alloc_noprof(scan_area_cache, gfp_kmemleak_mask(gfp));
 
 	raw_spin_lock_irqsave(&object->lock, flags);
 	if (!area) {
mm/slub.c renamed from mm/slub.c~mm-slub-avoid-recursive-loop-with-kmemleak +1 -1
@@ -2018,7 +2018,7 @@ prepare_slab_obj_exts_hook(struct kmem_c
 	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)

_

Patches currently in -mm which might be from [email protected] are