mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
Add a KASAN option to the kernel build
LLVM support for enabling KASAN has not yet landed so the option is not yet usable, but hopefully this will change soon. Reviewed by: imp, andrew MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29454
This commit is contained in:
parent
86887853c3
commit
01028c736c
2 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ ZSTDIO opt_zstdio.h
|
|||
|
||||
# Sanitizers
|
||||
COVERAGE opt_global.h
|
||||
KASAN opt_global.h
|
||||
KCOV
|
||||
KCSAN opt_global.h
|
||||
KUBSAN opt_global.h
|
||||
|
|
|
|||
Loading…
Reference in a new issue