Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101997326
D41157.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D41157.diff
View Options
diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile
--- a/cddl/lib/libdtrace/Makefile
+++ b/cddl/lib/libdtrace/Makefile
@@ -1,5 +1,7 @@
# $FreeBSD$
+.include <src.opts.mk>
+
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libgen/common
@@ -138,6 +140,11 @@
YFLAGS+=-d
+.if ${MK_DTRACE_ASAN} != "no"
+CFLAGS+= -fsanitize=address -fsanitize=undefined
+LDFLAGS+= -fsanitize=address -fsanitize=undefined
+.endif
+
LIBADD= ctf elf proc pthread rtld_db
CLEANFILES= dt_errtags.c dt_names.c
diff --git a/cddl/usr.sbin/dtrace/Makefile b/cddl/usr.sbin/dtrace/Makefile
--- a/cddl/usr.sbin/dtrace/Makefile
+++ b/cddl/usr.sbin/dtrace/Makefile
@@ -30,6 +30,11 @@
#CFLAGS+= -DNEED_ERRLOC
#YFLAGS+= -d
+.if ${MK_DTRACE_ASAN} != "no"
+CFLAGS+= -fsanitize=address -fsanitize=undefined
+LDFLAGS+= -fsanitize=address -fsanitize=undefined
+.endif
+
LIBADD= dtrace ctf elf proc spl
.if ${MK_DTRACE_TESTS} != "no"
diff --git a/cddl/usr.sbin/lockstat/Makefile b/cddl/usr.sbin/lockstat/Makefile
--- a/cddl/usr.sbin/lockstat/Makefile
+++ b/cddl/usr.sbin/lockstat/Makefile
@@ -1,5 +1,7 @@
# $FreeBSD$
+.include <src.opts.mk>
+
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/cmd/lockstat
PACKAGE= dtrace
@@ -26,6 +28,11 @@
-I${SRCTOP}/sys
CFLAGS+= -DHAVE_ISSETUGID
+.if ${MK_DTRACE_ASAN} != "no"
+CFLAGS+= -fsanitize=address -fsanitize=undefined
+LDFLAGS+= -fsanitize=address -fsanitize=undefined
+.endif
+
CFLAGS+= -DNEED_ERRLOC -g
#YFLAGS+= -d
diff --git a/cddl/usr.sbin/plockstat/Makefile b/cddl/usr.sbin/plockstat/Makefile
--- a/cddl/usr.sbin/plockstat/Makefile
+++ b/cddl/usr.sbin/plockstat/Makefile
@@ -1,5 +1,7 @@
# $FreeBSD$
+.include <src.opts.mk>
+
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/cmd/plockstat
PACKAGE= dtrace
@@ -26,6 +28,11 @@
-I${SRCTOP}/sys
CFLAGS+= -DHAVE_ISSETUGID
+.if ${MK_DTRACE_ASAN} != "no"
+CFLAGS+= -fsanitize=address -fsanitize=undefined
+LDFLAGS+= -fsanitize=address -fsanitize=undefined
+.endif
+
LIBADD= dtrace proc
.include <bsd.prog.mk>
diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -594,6 +594,11 @@
.It
.Va WITHOUT_CTF
.El
+.It Va WITH_DTRACE_ASAN
+Compile userspace DTrace code (libdtrace, dtrace(1), lockstat(1), plockstat(1))
+with address and undefined behavior sanitizers.
+Requires that Clang be used as the base system compiler
+and that the runtime support library is available.
.It Va WITH_DTRACE_TESTS
Build and install the DTrace test suite in
.Pa /usr/tests/cddl/usr.sbin/dtrace .
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -201,6 +201,7 @@
CLANG_FORMAT \
DETECT_TZ_CHANGES \
DISK_IMAGE_TOOLS_BOOTSTRAP \
+ DTRACE_ASAN \
DTRACE_TESTS \
EXPERIMENTAL \
HESIOD \
diff --git a/tools/build/options/WITH_DTRACE_ASAN b/tools/build/options/WITH_DTRACE_ASAN
new file mode 100644
--- /dev/null
+++ b/tools/build/options/WITH_DTRACE_ASAN
@@ -0,0 +1,4 @@
+Compile userspace DTrace code (libdtrace, dtrace(1), lockstat(1), plockstat(1))
+with address and undefined behavior sanitizers.
+Requires that Clang be used as the base system compiler
+and that the runtime support library is available.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 7, 8:52 AM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14507894
Default Alt Text
D41157.diff (3 KB)
Attached To
Mode
D41157: dtrace: Add WITH_DTRACE_ASAN.
Attached
Detach File
Event Timeline
Log In to Comment