Module Name: src Committed By: maxv Date: Sun Dec 8 11:53:54 UTC 2019
Modified Files: src/sys/arch/amd64/include: cpu.h src/sys/kern: subr_msan.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/arch/amd64/include/cpu.h cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_msan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/include/cpu.h diff -u src/sys/arch/amd64/include/cpu.h:1.66 src/sys/arch/amd64/include/cpu.h:1.67 --- src/sys/arch/amd64/include/cpu.h:1.66 Thu Nov 21 19:23:58 2019 +++ src/sys/arch/amd64/include/cpu.h Sun Dec 8 11:53:54 2019 @@ -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 @@ x86_curcpu(void) 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 @@ x86_curlwp(void) (*(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 */ Index: src/sys/kern/subr_msan.c diff -u src/sys/kern/subr_msan.c:1.4 src/sys/kern/subr_msan.c:1.5 --- src/sys/kern/subr_msan.c:1.4 Fri Dec 6 16:54:47 2019 +++ src/sys/kern/subr_msan.c Sun Dec 8 11:53:54 2019 @@ -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>