Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 2023 13:37:04 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b6c653c97463 - main - kmsan: Set -fno-sanitize-memory-param-retval for now
Message-ID:  <202310171337.39HDb4Xp095686@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=b6c653c9746342b373af01979319b3cb123b2872

commit b6c653c9746342b373af01979319b3cb123b2872
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-10-16 19:45:42 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-17 13:05:45 +0000

    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.
---
 sys/conf/files       | 2 +-
 sys/conf/kern.pre.mk | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index dc837eb02c06..8c3bdca61905 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -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
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202310171337.39HDb4Xp095686>