Source-Changes-HG archive

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

[src/trunk]: src/sys Use the inlines; it is actually fine, since the compiler...



details:   https://anonhg.NetBSD.org/src/rev/3bc05c8070a2
branches:  trunk
changeset: 847049:3bc05c8070a2
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Dec 08 11:53:54 2019 +0000

description:
Use the inlines; it is actually fine, since the compiler drops the inlines
if the caller is kmsan-instrumented, forcing a white-listing of the memory
access.

diffstat:

 sys/arch/amd64/include/cpu.h |  21 +++------------------
 sys/kern/subr_msan.c         |   6 ++----
 2 files changed, 5 insertions(+), 22 deletions(-)

diffs (75 lines):

diff -r 8bb521c089e3 -r 3bc05c8070a2 sys/arch/amd64/include/cpu.h
--- a/sys/arch/amd64/include/cpu.h      Sun Dec 08 11:48:15 2019 +0000
+++ b/sys/arch/amd64/include/cpu.h      Sun Dec 08 11:53:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.66 2019/11/21 19:23:58 ad Exp $      */
+/*     $NetBSD: cpu.h,v 1.67 2019/12/08 11:53:54 maxv Exp $    */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -43,23 +43,12 @@
 
 #ifdef _KERNEL
 
-#ifdef _KERNEL_OPT
-#include "opt_kmsan.h"
-#endif
-
 #if defined(__GNUC__) && !defined(_MODULE)
 
-/*
- * KMSAN: disable the inlines below, to force the use of the ASM functions,
- * where no KMSAN instrumentation is added. This is because the instrumentation
- * does not handle the segment registers correctly. And there appears to be no
- * way to tell LLVM not to add KMSAN instrumentation in these __asm blocks.
- */
-#if !defined(KMSAN) || defined(KMSAN_NO_INST)
 static struct cpu_info *x86_curcpu(void);
 static lwp_t *x86_curlwp(void);
 
-__inline static struct cpu_info * __unused
+__inline static struct cpu_info * __unused __nomsan
 x86_curcpu(void)
 {
        struct cpu_info *ci;
@@ -71,7 +60,7 @@
        return ci;
 }
 
-__inline static lwp_t * __unused __attribute__ ((const))
+__inline static lwp_t * __unused __nomsan __attribute__ ((const))
 x86_curlwp(void)
 {
        lwp_t *l;
@@ -82,10 +71,6 @@
            (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp)));
        return l;
 }
-#else
-struct cpu_info *x86_curcpu(void);
-lwp_t *x86_curlwp(void);
-#endif
 
 #endif /* __GNUC__ && !_MODULE */
 
diff -r 8bb521c089e3 -r 3bc05c8070a2 sys/kern/subr_msan.c
--- a/sys/kern/subr_msan.c      Sun Dec 08 11:48:15 2019 +0000
+++ b/sys/kern/subr_msan.c      Sun Dec 08 11:53:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_msan.c,v 1.4 2019/12/06 16:54:47 maxv Exp $       */
+/*     $NetBSD: subr_msan.c,v 1.5 2019/12/08 11:53:54 maxv Exp $       */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -29,10 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#define KMSAN_NO_INST
-
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.4 2019/12/06 16:54:47 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.5 2019/12/08 11:53:54 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>



Home | Main Index | Thread Index | Old Index