Skip to contentSkip to conversation

mm/slub.c: Add slab randomization.

PATCH In review George Spelvin 1 participant 1 message Mar 16, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/8 mm/slub.c: Add slab randomization.

If SLAB_RANDOMIZE is set, the initial free list is shuffled into random order to make it harder for an attacker to control where a buffer overrun attack will overrun into.

Not supported (does nothing) for SLAB and SLOB allocators.

---
 include/linux/slab.h |    2 +
 mm/slub.c            |   69 +++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 59 insertions(+), 12 deletions(-)
include/linux/slab.h +2 -0
index fa90866..8e812f1 100644
@@ -79,6 +79,8 @@
 /* The following flags affect the page allocator grouping pages by mobility */
 #define SLAB_RECLAIM_ACCOUNT	0x00020000UL		/* Objects are reclaimable */
 #define SLAB_TEMPORARY		SLAB_RECLAIM_ACCOUNT	/* Objects are short-lived */
+
+#define SLAB_RANDOMIZE		0x04000000UL	/* Randomize allocation order */
 /*
  * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
  *
mm/slub.c +57 -12

111 lines not on this page · raw message

Signature · 8 lines
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>