aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2023-10-16 19:45:42 +0000
committerMark Johnston <markj@FreeBSD.org>2023-10-22 15:01:26 +0000
commit41d1dc7005f010074c1e6f7fc8adf44dcbd473cf (patch)
tree61d8d7984ef220589961f9d33c9864bb49d88616
parentf5951b13246a97824c481b66a0ad900c67f0a950 (diff)
kmsan: Set -fno-sanitize-memory-param-retval for now
As of LLVM 16, -fsanitize-memory-param-retval is the default. It yields significantly smaller code, but the KMSAN runtime interceptors need to be updated to stop checking shadow state of parameters. Apply a minimal workaround for now. Approved by: re (gjb) MFC after: 3 days Sponsored by: Klara, Inc. Sponsored by: Juniper Networks, Inc. (cherry picked from commit b6c653c9746342b373af01979319b3cb123b2872) (cherry picked from commit c89523d1c4be8f3408fb591261f3093b65dbb675)
-rw-r--r--sys/conf/files2
-rw-r--r--sys/conf/kern.pre.mk5
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 8d38b9cc8a2e..b9763d167812 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3871,7 +3871,7 @@ kern/subr_mchain.c optional libmchain
kern/subr_memdesc.c standard
kern/subr_module.c standard
kern/subr_msan.c optional kmsan \
- compile-with "${NORMAL_C:N-fsanitize*:N-fstack-protector*}"
+ compile-with "${NORMAL_C:N-fsanitize*:N-fno-sanitize*:N-fstack-protector*}"
kern/subr_msgbuf.c standard
kern/subr_param.c standard
kern/subr_pcpu.c standard
diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 4d37cd4156f0..158175eb6899 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -122,8 +122,11 @@ SAN_CFLAGS+= -DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kcsan \
KMSAN_ENABLED!= grep KMSAN opt_global.h || true ; echo
.if !empty(KMSAN_ENABLED)
+# Disable -fno-sanitize-memory-param-retval until interceptors have been
+# updated to work properly with it.
SAN_CFLAGS+= -DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kmsan \
- -fsanitize=kernel-memory
+ -fsanitize=kernel-memory \
+ -fno-sanitize-memory-param-retval
.endif
KUBSAN_ENABLED!= grep KUBSAN opt_global.h || true ; echo