Source-Changes-HG archive

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

[src/trunk]: src Make kMSan compatible with KCOV. With kMSan we are forced to...



details:   https://anonhg.NetBSD.org/src/rev/48d1bc8955f1
branches:  trunk
changeset: 461085:48d1bc8955f1
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Nov 15 09:44:44 2019 +0000

description:
Make kMSan compatible with KCOV. With kMSan we are forced to stay with the
fsanitize flag on subr_kcov.c, which means that kMSan will instrument KCOV.
We add a bunch of __nomsan attributes to reduce this instrumentation, but
it does not remove it completely. That's fine.

diffstat:

 share/mk/bsd.sys.mk  |   4 ++--
 sys/kern/subr_kcov.c |  26 +++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diffs (135 lines):

diff -r 93d978561a6e -r 48d1bc8955f1 share/mk/bsd.sys.mk
--- a/share/mk/bsd.sys.mk       Fri Nov 15 09:03:26 2019 +0000
+++ b/share/mk/bsd.sys.mk       Fri Nov 15 09:44:44 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.sys.mk,v 1.295 2019/11/05 20:19:17 maxv Exp $
+#      $NetBSD: bsd.sys.mk,v 1.296 2019/11/15 09:44:44 maxv Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -247,7 +247,7 @@
 .if ${KCOV:U0} > 0
 KCOVFLAGS=     -fsanitize-coverage=trace-pc
 .for f in subr_kcov.c subr_lwp_specificdata.c subr_specificdata.c subr_asan.c \
-       subr_csan.c
+       subr_csan.c subr_msan.c
 KCOVFLAGS.${f}=                # empty
 .endfor
 CFLAGS+=       ${KCOVFLAGS.${.IMPSRC:T}:U${KCOVFLAGS}}
diff -r 93d978561a6e -r 48d1bc8955f1 sys/kern/subr_kcov.c
--- a/sys/kern/subr_kcov.c      Fri Nov 15 09:03:26 2019 +0000
+++ b/sys/kern/subr_kcov.c      Fri Nov 15 09:44:44 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_kcov.c,v 1.8 2019/05/26 05:41:45 kamil Exp $      */
+/*     $NetBSD: subr_kcov.c,v 1.9 2019/11/15 09:44:44 maxv Exp $       */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -339,7 +339,7 @@
        return error;
 }
 
-static inline bool
+static inline bool __nomsan
 in_interrupt(void)
 {
        return curcpu()->ci_idepth >= 0;
@@ -347,7 +347,7 @@
 
 void __sanitizer_cov_trace_pc(void);
 
-void
+void __nomsan
 __sanitizer_cov_trace_pc(void)
 {
        extern int cold;
@@ -388,7 +388,7 @@
        }
 }
 
-static void
+static void __nomsan
 trace_cmp(uint64_t type, uint64_t arg1, uint64_t arg2, intptr_t pc)
 {
        extern int cold;
@@ -433,7 +433,7 @@
 
 void __sanitizer_cov_trace_cmp1(uint8_t arg1, uint8_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_cmp1(uint8_t arg1, uint8_t arg2)
 {
 
@@ -443,7 +443,7 @@
 
 void __sanitizer_cov_trace_cmp2(uint16_t arg1, uint16_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_cmp2(uint16_t arg1, uint16_t arg2)
 {
 
@@ -453,7 +453,7 @@
 
 void __sanitizer_cov_trace_cmp4(uint32_t arg1, uint32_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_cmp4(uint32_t arg1, uint32_t arg2)
 {
 
@@ -463,7 +463,7 @@
 
 void __sanitizer_cov_trace_cmp8(uint64_t arg1, uint64_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_cmp8(uint64_t arg1, uint64_t arg2)
 {
 
@@ -473,7 +473,7 @@
 
 void __sanitizer_cov_trace_const_cmp1(uint8_t arg1, uint8_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_const_cmp1(uint8_t arg1, uint8_t arg2)
 {
 
@@ -483,7 +483,7 @@
 
 void __sanitizer_cov_trace_const_cmp2(uint16_t arg1, uint16_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_const_cmp2(uint16_t arg1, uint16_t arg2)
 {
 
@@ -493,7 +493,7 @@
 
 void __sanitizer_cov_trace_const_cmp4(uint32_t arg1, uint32_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_const_cmp4(uint32_t arg1, uint32_t arg2)
 {
 
@@ -503,7 +503,7 @@
 
 void __sanitizer_cov_trace_const_cmp8(uint64_t arg1, uint64_t arg2);
 
-void
+void __nomsan
 __sanitizer_cov_trace_const_cmp8(uint64_t arg1, uint64_t arg2)
 {
 
@@ -513,7 +513,7 @@
 
 void __sanitizer_cov_trace_switch(uint64_t val, uint64_t *cases);
 
-void
+void __nomsan
 __sanitizer_cov_trace_switch(uint64_t val, uint64_t *cases)
 {
        uint64_t i, nbits, ncases, type;



Home | Main Index | Thread Index | Old Index