Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Nov 2019 13:22:23 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354947 - in head/sys: amd64/include arm64/include kern
Message-ID:  <201911211322.xALDMNHa023512@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Thu Nov 21 13:22:23 2019
New Revision: 354947
URL: https://svnweb.freebsd.org/changeset/base/354947

Log:
  Add kcsan_md_unsupported from NetBSD.
  
  It's used to ignore virtual addresses that may have a different physical
  address depending on the CPU.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/amd64/include/csan.h
  head/sys/arm64/include/csan.h
  head/sys/kern/subr_csan.c

Modified: head/sys/amd64/include/csan.h
==============================================================================
--- head/sys/amd64/include/csan.h	Thu Nov 21 13:12:58 2019	(r354946)
+++ head/sys/amd64/include/csan.h	Thu Nov 21 13:22:23 2019	(r354947)
@@ -36,6 +36,12 @@
 #include <machine/vmparam.h>
 
 static inline bool
+kcsan_md_unsupported(vm_offset_t addr)
+{
+	return false;
+}
+
+static inline bool
 kcsan_md_is_avail(void)
 {
 	return true;

Modified: head/sys/arm64/include/csan.h
==============================================================================
--- head/sys/arm64/include/csan.h	Thu Nov 21 13:12:58 2019	(r354946)
+++ head/sys/arm64/include/csan.h	Thu Nov 21 13:22:23 2019	(r354947)
@@ -36,6 +36,12 @@
 #include <machine/vmparam.h>
 
 static inline bool
+kcsan_md_unsupported(vm_offset_t addr)
+{
+	return false;
+}
+
+static inline bool
 kcsan_md_is_avail(void)
 {
 	return true;

Modified: head/sys/kern/subr_csan.c
==============================================================================
--- head/sys/kern/subr_csan.c	Thu Nov 21 13:12:58 2019	(r354946)
+++ head/sys/kern/subr_csan.c	Thu Nov 21 13:22:23 2019	(r354947)
@@ -151,6 +151,8 @@ kcsan_access(uintptr_t addr, size_t size, bool write, 
 
 	if (__predict_false(!kcsan_enabled))
 		return;
+	if (__predict_false(kcsan_md_unsupported((vm_offset_t)addr)))
+		return;
 
 	new.addr = addr;
 	new.size = size;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201911211322.xALDMNHa023512>