diff --git a/sys/rump/Makefile.rump b/sys/rump/Makefile.rump index 1c561c37e897..b1c0788252e4 100644 --- a/sys/rump/Makefile.rump +++ b/sys/rump/Makefile.rump @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.rump,v 1.132 2021/04/25 15:16:56 christos Exp $ +# $NetBSD: Makefile.rump,v 1.133 2021/07/07 11:51:45 martin Exp $ # .if !defined(_RUMP_MK) @@ -24,6 +24,11 @@ CPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern # aborts after kern_assert on NULL pointer checks. CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :} +.if ${RUMP_SANITIZE:Uno} != "no" +CFLAGS+= -fsanitize=${RUMP_SANITIZE} +LDFLAGS+= -fsanitize=${RUMP_SANITIZE} +.endif + # NULL + 0 arithmetic raises LLVM UBSan warnings, specially in sys/pslist.h # in the type-safe macros _PSLIST_VALIDATE_PTRS and _PSLIST_VALIDATE_CONTAINER. .if ${MKSANITIZER:Uno} == "yes" || ${MKLIBCSANITIZER:Uno} == "yes" diff --git a/tests/Makefile.inc b/tests/Makefile.inc index f4ddbca2779f..81e95b6933bb 100644 --- a/tests/Makefile.inc +++ b/tests/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.9 2020/05/17 18:52:43 christos Exp $ +# $NetBSD: Makefile.inc,v 1.10 2021/07/07 11:51:45 martin Exp $ WARNS ?= 4 CWARNFLAGS+= -Wno-missing-noreturn TOOLSSRCDIR:= ${.PARSEDIR} @@ -9,3 +9,6 @@ LIBRUMPFIFO_PRE = -lrumpvfs_fifofs -lrumpnet_local -lrumpnet_net -lrumpnet LIBRUMPFIFO = -lrumpvfs_nofifofs LIBRUMPBASE = ${LIBRUMPFIFO_PRE} -lrumpvfs -lrump -lrumpvfs -lrumpvfs_nofifofs -lrumpuser -lrump -lpthread +.if ${RUMP_SANITIZE:Uno} != "no" +LIBRUMPBASE+= -fsanitize=${RUMP_SANITIZE} +.endif diff --git a/tests/rump/modautoload/Makefile b/tests/rump/modautoload/Makefile index 56376ea600a0..e58580ebabc4 100644 --- a/tests/rump/modautoload/Makefile +++ b/tests/rump/modautoload/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.12 2020/05/26 18:52:29 christos Exp $ +# $NetBSD: Makefile,v 1.13 2021/07/07 11:51:45 martin Exp $ # .include @@ -25,6 +25,10 @@ LDADD+= \ LDADD+= -lrumpuser -lpthread DPADD+= ${LIBRUMPVFS} ${LIBRUMP} ${LIBRUMPUSER} +.if ${RUMP_SANITIZE:Uno} != "no" +LDADD+= -fsanitize=${RUMP_SANITIZE} +.endif + WARNS= 4 # To include a rump version of sysctlbyname() diff --git a/usr.bin/rump_allserver/Makefile b/usr.bin/rump_allserver/Makefile index 87d528c612ef..78774cfe71a7 100644 --- a/usr.bin/rump_allserver/Makefile +++ b/usr.bin/rump_allserver/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.13 2020/05/17 19:37:15 christos Exp $ +# $NetBSD: Makefile,v 1.14 2021/07/07 11:51:45 martin Exp $ # PROG= rump_allserver @@ -14,4 +14,8 @@ RUMPTOP=${.CURDIR}/../../sys/rump LDADD+= ${RUMPDEVLDADD} ${RUMPFSLDADD} ${RUMPKERNLDADD} ${RUMPNETLDADD} LDADD+= -lrumpdev -lrumpnet -lrumpvfs -lrump -lrumpvfs -lrumpvfs_nofifofs -lrump -lrumpuser -lpthread +.if ${RUMP_SANITIZE:Uno} != "no" +LDADD+= -fsanitize=${RUMP_SANITIZE} +.endif + .include diff --git a/usr.bin/rump_dhcpclient/Makefile b/usr.bin/rump_dhcpclient/Makefile index 0a9a11a6183a..bac3cdedbe23 100644 --- a/usr.bin/rump_dhcpclient/Makefile +++ b/usr.bin/rump_dhcpclient/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2017/05/11 13:20:02 sevan Exp $ +# $NetBSD: Makefile,v 1.4 2021/07/07 11:51:46 martin Exp $ # PROG= rump.dhcpclient @@ -6,4 +6,8 @@ SRCS= main.c bpf.c common.c configure.c dhcp.c if-bsd.c net.c LDADD+= -lrumpclient +.if ${RUMP_SANITIZE:Uno} != "no" +LDADD+= -fsanitize=${RUMP_SANITIZE} +.endif + .include diff --git a/usr.bin/rump_halt/Makefile b/usr.bin/rump_halt/Makefile index a77267f016fb..de0ddd4f4d8d 100644 --- a/usr.bin/rump_halt/Makefile +++ b/usr.bin/rump_halt/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2017/05/11 13:20:02 sevan Exp $ +# $NetBSD: Makefile,v 1.4 2021/07/07 11:51:46 martin Exp $ # PROG= rump.halt @@ -6,4 +6,8 @@ PROG= rump.halt LDADD+= -lrumpclient DPADD+= ${RUMPCLIENT} +.if ${RUMP_SANITIZE:Uno} != "no" +LDADD+= -fsanitize=${RUMP_SANITIZE} +.endif + .include diff --git a/usr.bin/rump_server/Makefile b/usr.bin/rump_server/Makefile index 6ff034e05c3e..47823a796639 100644 --- a/usr.bin/rump_server/Makefile +++ b/usr.bin/rump_server/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2020/05/16 12:46:57 christos Exp $ +# $NetBSD: Makefile,v 1.15 2021/07/07 11:51:46 martin Exp $ # .PATH: ${.CURDIR}/../rump_allserver @@ -13,4 +13,8 @@ LDADD+= \ -Wl,--no-whole-archive LDADD+= -lpthread +.if ${RUMP_SANITIZE:Uno} != "no" +LDADD+= -fsanitize=${RUMP_SANITIZE} +.endif + .include diff --git a/usr.sbin/npf/npftest/Makefile b/usr.sbin/npf/npftest/Makefile index 35865b0f79bb..83cfc6f7d8b9 100644 --- a/usr.sbin/npf/npftest/Makefile +++ b/usr.sbin/npf/npftest/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.13 2020/05/16 12:42:11 christos Exp $ +# $NetBSD: Makefile,v 1.14 2021/07/07 11:51:46 martin Exp $ # # Public Domain # @@ -20,6 +20,10 @@ LDADD+= -L${LIBNPFTEST} -lnpftest LDADD+= -lrump -lrumpvfs_nofifofs -lrumpvfs -lrumpuser LDADD+= -lrumpnet -lrumpnet_net -lrumpdev_bpf +.if ${RUMP_SANITIZE:Uno} != "no" +LDADD+= -fsanitize=${RUMP_SANITIZE} +.endif + .include .if ${MKSLJIT} != "no" diff --git a/usr.sbin/puffs/Makefile.inc b/usr.sbin/puffs/Makefile.inc index 2e6d1a072900..79112761836b 100644 --- a/usr.sbin/puffs/Makefile.inc +++ b/usr.sbin/puffs/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.17 2020/05/17 18:59:02 christos Exp $ +# $NetBSD: Makefile.inc,v 1.18 2021/07/07 11:51:46 martin Exp $ WARNS?= 4 @@ -46,6 +46,10 @@ LDADD+= -lrumpdev_disk -lrumpdev LDADD+= -lp2k -lukfs -lrumpvfs -lrumpvfs_nofifofs -lrump -lrumpuser -lpuffs -lutil LDADD+= -lpthread +.if ${RUMP_SANITIZE:Uno} != "no" +LDADD+= -fsanitize=${RUMP_SANITIZE} +.endif + DPADD+= ${LIBP2K} ${LIBUKFS} ${LIBRUMPVFS} ${LIBRUMP} ${LIBRUMPUSER} DPADD+= ${LIBPUFFS} ${LIBUTIL} ${LIBPTHREAD} .endif # ISRUMP