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.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
This commit is contained in:
Mark Johnston 2023-10-16 15:45:42 -04:00
parent e5caed1406
commit b6c653c974
2 changed files with 5 additions and 2 deletions

View file

@ -3872,7 +3872,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

View file

@ -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