Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/include/sys Mask NULL + 0 LLVM UBSan reports in the AT...



details:   https://anonhg.NetBSD.org/src/rev/2e489ba5d6f3
branches:  trunk
changeset: 933944:2e489ba5d6f3
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sun May 31 16:36:07 2020 +0000

description:
Mask NULL + 0 LLVM UBSan reports in the ATF test: t_pslist.c

Pass -fno-delete-null-pointer-checks for Clang for the
MKSANITIZER/MKLIBCSANITIZER build

diffstat:

 tests/include/sys/Makefile |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 7ac929b8f041 -r 2e489ba5d6f3 tests/include/sys/Makefile
--- a/tests/include/sys/Makefile        Sun May 31 16:32:07 2020 +0000
+++ b/tests/include/sys/Makefile        Sun May 31 16:36:07 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2020/03/01 18:08:15 christos Exp $
+# $NetBSD: Makefile,v 1.16 2020/05/31 16:36:07 kamil Exp $
 
 NOMAN=         # defined
 
@@ -14,6 +14,13 @@
 TESTS_C+=              t_tree
 TESTS_C+=              t_types
 
+# NULL + 0 arithmetic raises LLVM UBSan warnings, specially in sys/pslist.h
+# in the type-safe macros _PSLIST_VALIDATE_PTRS and _PSLIST_VALIDATE_CONTAINER.
+# See also src/sys/rump/Makefile.rump
+.if ${MKSANITIZER:Uno} == "yes" || ${MKLIBCSANITIZER:Uno} == "yes"
+COPTS.t_pslist.c+=     ${${ACTIVE_CC} == "clang":? -fno-delete-null-pointer-checks :}
+.endif
+
 CPPFLAGS.t_pslist.c+=  -I${NETBSDSRCDIR}/sys
 LDADD.t_bitops+=       -lm
 



Home | Main Index | Thread Index | Old Index