[PATCH v2 1/6] mm/slab: Enable SLAB_FREELIST_HARDENED by default
From: Chris Down
Date: Thu Oct 29 2026 - 02:07:50 EST
SLAB_FREELIST_HARDENED obfuscates the free pointers stored in free
objects, and catches naive double frees and frees to the wrong cache.
Most distros already enable it, and with sheaves its cost is small,
since the per-cpu fast paths don't touch freelists. Measurements also
show this quite clearly [1][2].
So let's just enable it by default. SLAB_BUCKETS defaults to
SLAB_FREELIST_HARDENED, so it's now enabled by default too.
Link: https://lore.kernel.org/all/auITixAJMfLtfa7i@xxxxxxxxxxxxxx/ [1]
Link: https://lore.kernel.org/all/179312451613.474906.1475329637924619088@xxxxxxxxxx/ [2]
Suggested-by: Vlastimil Babka <vbabka@xxxxxxxxxx>
Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
---
mm/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/Kconfig b/mm/Kconfig
index 604c58199acb..17d017e8fbef 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -208,6 +208,7 @@ config SLAB_FREELIST_RANDOM
config SLAB_FREELIST_HARDENED
bool "Harden slab freelist metadata"
depends on !SLUB_TINY
+ default y
help
Many kernel heap attacks try to target slab cache metadata and
other infrastructure. This options makes minor performance
--
2.54.0