[PATCH v3 13/13] configs/hardening: Enable CONFIG_INIT_ON_FREE_DEFAULT_ON
From: Kees Cook
Date: Thu Jul 17 2025 - 19:28:08 EST
To reduce stale data lifetimes, enable CONFIG_INIT_ON_FREE_DEFAULT_ON as
well. This matches the addition of CONFIG_STACKLEAK=y, which is doing
similar for stack memory.
Signed-off-by: Kees Cook <kees@xxxxxxxxxx>
---
Cc: "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx>
Cc: <linux-hardening@xxxxxxxxxxxxxxx>
---
kernel/configs/hardening.config | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/configs/hardening.config b/kernel/configs/hardening.config
index d24c2772d04d..64caaf997fc0 100644
--- a/kernel/configs/hardening.config
+++ b/kernel/configs/hardening.config
@@ -60,6 +60,9 @@ CONFIG_LIST_HARDENED=y
# Initialize all heap variables to zero on allocation.
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
+# Initialize all heap variables to zero on free to reduce stale data lifetime.
+CONFIG_INIT_ON_FREE_DEFAULT_ON=y
+
# Initialize all stack variables to zero on function entry.
CONFIG_INIT_STACK_ALL_ZERO=y
--
2.34.1