aboutsummaryrefslogtreecommitdiff
path: root/sys/conf/kern.pre.mk
diff options
context:
space:
mode:
Diffstat (limited to 'sys/conf/kern.pre.mk')
-rw-r--r--sys/conf/kern.pre.mk10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index bb27969d6eca..539605f60ca0 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -92,6 +92,16 @@ CFLAGS+= -fno-common
# XXX LOCORE means "don't declare C stuff" not "for locore.s".
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}}
+KASAN_ENABLED!= grep KASAN opt_global.h || true ; echo
+.if !empty(KASAN_ENABLED)
+SAN_CFLAGS+= -fsanitize=kernel-address \
+ -mllvm -asan-stack=true \
+ -mllvm -asan-instrument-dynamic-allocas=true \
+ -mllvm -asan-globals=true \
+ -mllvm -asan-use-after-scope=true \
+ -mllvm -asan-instrumentation-with-call-threshold=0
+.endif
+
KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo
.if !empty(KCSAN_ENABLED)
SAN_CFLAGS+= -fsanitize=thread