Skip to contentSkip to conversation

slub-add-back-check-for-free-nonslab-objects.patch removed from -mm tree

merged [email protected] 1 participant 1 message Nov 11, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: slub: add back check for free nonslab objects
has been removed from the -mm tree. Its filename was
slub-add-back-check-for-free-nonslab-objects.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Kefeng Wang <[email protected]>
Subject: slub: add back check for free nonslab objects

After commit ("f227f0faf63b slub: fix unreclaimable slab stat for bulk free"), the check for free nonslab page is replaced by VM_BUG_ON_PAGE, which only check with CONFIG_DEBUG_VM enabled, but this config may impact performance, so it only for debug.

Commit ("0937502af7c9 slub: Add check for kfree() of non slab objects.") add the ability, which should be needed in any configs to catch the invalid free, they even could be potential issue, eg, memory corruption, use after free and double free, so replace VM_BUG_ON_PAGE to WARN_ON_ONCE, add object address printing to help use to debug the issue.

Cc Matthew Wilcox <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc David Rienjes <[email protected]>
Cc Joonsoo Kim <[email protected]>

---

 mm/slub.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/slub.c renamed from mm/slub.c~slub-add-back-check-for-free-nonslab-objects +3 -1
@@ -3522,7 +3522,9 @@ static inline void free_nonslab_page(str
 {
 	unsigned int order = compound_order(page);
 
-	VM_BUG_ON_PAGE(!PageCompound(page), page);
+	if (WARN_ON_ONCE(!PageCompound(page)))
+		pr_warn_once("object pointer: 0x%p\n", object);
+
 	kfree_hook(object);
 	mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, -(PAGE_SIZE << order));
 	__free_pages(page, order);

_

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