Skip to contentSkip to conversation

mm-slubc-add-a-naive-detection-of-double-free-or-corruption.patch removed from -mm tree

merged [email protected] 1 participant 1 message Sep 7, 2017

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm/slub.c: add a naive detection of double free or corruption
has been removed from the -mm tree. Its filename was
mm-slubc-add-a-naive-detection-of-double-free-or-corruption.patch

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

------------------------------------------------------
From: Alexander Popov <[email protected]>
Subject: mm/slub.c: add a naive detection of double free or corruption

Add an assertion similar to "fasttop" check in GNU C Library allocator as a part of SLAB_FREELIST_HARDENED feature. An object added to a singly linked freelist should not point to itself. That helps to detect some double free errors (e.g. CVE-2017-2636) without slub_debug and KASAN.

Cc Kees Cook <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc David Rientjes <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Paul E McKenney <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Tycho Andersen <[email protected]>

---

 mm/slub.c |    4 ++++
 1 file changed, 4 insertions(+)
mm/slub.c renamed from mm/slub.c~mm-slubc-add-a-naive-detection-of-double-free-or-corruption +4 -0
diff -puN mm/slub.c~mm-slubc-add-a-naive-detection-of-double-free-or-corruption mm/slub.c
@@ -290,6 +290,10 @@ static inline void set_freepointer(struc
 {
 	unsigned long freeptr_addr = (unsigned long)object + s->offset;
 
+#ifdef CONFIG_SLAB_FREELIST_HARDENED
+	BUG_ON(object == fp); /* naive detection of double free or corruption */
+#endif
+
 	*(void **)freeptr_addr = freelist_ptr(s, fp, freeptr_addr);
 }
 

_

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