Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Exclude the PTE space from KCSAN, since there the same V...
details: https://anonhg.NetBSD.org/src/rev/3d1e1eebf688
branches: trunk
changeset: 460897:3d1e1eebf688
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Nov 08 12:36:10 2019 +0000
description:
Exclude the PTE space from KCSAN, since there the same VA can point to
different PAs.
diffstat:
sys/arch/amd64/include/csan.h | 11 ++++++++++-
sys/kern/subr_csan.c | 6 ++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diffs (55 lines):
diff -r 7df973774dd8 -r 3d1e1eebf688 sys/arch/amd64/include/csan.h
--- a/sys/arch/amd64/include/csan.h Fri Nov 08 11:12:09 2019 +0000
+++ b/sys/arch/amd64/include/csan.h Fri Nov 08 12:36:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csan.h,v 1.2 2019/11/06 06:57:22 maxv Exp $ */
+/* $NetBSD: csan.h,v 1.3 2019/11/08 12:36:11 maxv Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,9 +30,18 @@
*/
#include <sys/ksyms.h>
+#include <uvm/uvm.h>
+#include <amd64/pmap.h>
#include <x86/cpufunc.h>
static inline bool
+kcsan_md_unsupported(vaddr_t addr)
+{
+ return (addr >= (vaddr_t)PTE_BASE &&
+ addr < ((vaddr_t)PTE_BASE + NBPD_L4));
+}
+
+static inline bool
kcsan_md_is_avail(void)
{
return true;
diff -r 7df973774dd8 -r 3d1e1eebf688 sys/kern/subr_csan.c
--- a/sys/kern/subr_csan.c Fri Nov 08 11:12:09 2019 +0000
+++ b/sys/kern/subr_csan.c Fri Nov 08 12:36:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_csan.c,v 1.2 2019/11/06 06:57:22 maxv Exp $ */
+/* $NetBSD: subr_csan.c,v 1.3 2019/11/08 12:36:10 maxv Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.2 2019/11/06 06:57:22 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.3 2019/11/08 12:36:10 maxv Exp $");
#include "opt_kcsan.h"
@@ -136,6 +136,8 @@
if (__predict_false(!kcsan_enabled))
return;
+ if (__predict_false(kcsan_md_unsupported((vaddr_t)addr)))
+ return;
new.addr = addr;
new.size = size;
Home |
Main Index |
Thread Index |
Old Index