Skip to contentSkip to conversation

hardening: Enable KFENCE in the hardening config

PATCH Applied Marco Elver 3 participants 3 messages Feb 12, 2024 Kernel hardening (not covered by other areas)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hardening: Enable KFENCE in the hardening config

KFENCE is not a security mitigation mechanism (due to sampling), but has the performance characteristics of unintrusive hardening techniques. When used at scale, however, it improves overall security by allowing kernel developers to detect heap memory-safety bugs cheaply.

---
 kernel/configs/hardening.config | 3 +++
 1 file changed, 3 insertions(+)
kernel/configs/hardening.config +3 -0
index 95a400f042b1..79c865bfb116 100644
@@ -46,6 +46,9 @@ CONFIG_UBSAN_BOUNDS=y
 # CONFIG_UBSAN_ALIGNMENT
 CONFIG_UBSAN_SANITIZE_ALL=y
 
+# Sampling-based heap out-of-bounds and use-after-free detection.
+CONFIG_KFENCE=y
+
 # Linked list integrity checking.
 CONFIG_LIST_HARDENED=y
 
Signature · 1 line
2.43.0.687.g38aa6559b0-goog
#1 lore raw

Hi Marco,

Quoted 4 lines · Marco Elver

KFENCE is not a security mitigation mechanism (due to sampling), but has the performance characteristics of unintrusive hardening techniques. When used at scale, however, it improves overall security by allowing kernel developers to detect heap memory-safety bugs cheaply.

Thank you for having sent this patch!

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
Applied
#2 lore raw
In reply to Marco Elver
Quoted 9 lines · Marco Elver

KFENCE is not a security mitigation mechanism (due to sampling), but has the performance characteristics of unintrusive hardening techniques. When used at scale, however, it improves overall security by allowing kernel developers to detect heap memory-safety bugs cheaply.

Thanks! Applied to my for-next/hardening tree.

https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/hardening&id=1f82cb2f3859540120e990a79abfee8151ea6b93

-Kees

Signature · 1 line
Kees Cook