Source-Changes-HG archive

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

[src/trunk]: src/tests/kernel Adapt tests/kernel/t_subr_prf for MKSANITIZER



details:   https://anonhg.NetBSD.org/src/rev/919dca02adbf
branches:  trunk
changeset: 964753:919dca02adbf
user:      kamil <kamil%NetBSD.org@localhost>
date:      Thu Aug 15 08:46:09 2019 +0000

description:
Adapt tests/kernel/t_subr_prf for MKSANITIZER

Allow to rename snprintf-like functions to avoid clashes with a sanitizer.

This tests needs a fixup to remove 'undef symbol' from the test code
generator.

diffstat:

 tests/kernel/Makefile |  15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diffs (36 lines):

diff -r 29f85a28adaf -r 919dca02adbf tests/kernel/Makefile
--- a/tests/kernel/Makefile     Thu Aug 15 08:42:59 2019 +0000
+++ b/tests/kernel/Makefile     Thu Aug 15 08:46:09 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.60 2019/06/07 21:18:16 christos Exp $
+# $NetBSD: Makefile,v 1.61 2019/08/15 08:46:09 kamil Exp $
 
 NOMAN=         # defined
 
@@ -66,6 +66,11 @@
 
 t_subr_prf.c: gen_t_subr_prf ${NETBSDSRCDIR}/sys/kern/subr_prf.c
        ${HOST_SH} ${.ALLSRC} ${.TARGET}
+.if ${MKSANITIZER:Uno} == "yes"
+       # These symbols will be redefined by MKSANITIZER
+       ${TOOL_SED} -i '/undef .*printf/d' ${.TARGET}
+.endif
+
 CPPFLAGS.t_subr_prf.c= -Wno-pointer-sign       # XXX platform vs kernel SHA2
 
 .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc"
@@ -73,6 +78,14 @@
 CPPFLAGS.t_subr_prf.c+=        -Wno-error=format-truncation
 .endif
 
+SANITIZER_RENAME_CLASSES+=             t_subr_prf
+SANITIZER_RENAME_FILES.t_subr_prf+=    t_subr_prf.c
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=   snprintf
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=   vsnprintf
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=   sprintf
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=   vsnprintf
+SANITIZER_RENAME_SYMBOL.t_subr_prf+=   vasprintf
+
 CLEANFILES+=   t_subr_prf.c
 
 LDADD.h_segv+= -lm



Home | Main Index | Thread Index | Old Index