aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/csan.h
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2019-11-20 14:37:48 +0000
committerAndrew Turner <andrew@FreeBSD.org>2019-11-20 14:37:48 +0000
commit0cb5357037c0169cb546365878afe601bd2d6c8b (patch)
tree82126fe6d7c2c55d92d73f632478c390acbae1a0 /sys/sys/csan.h
parentd578a4256ef67218d2791b701854677438f30a63 (diff)
downloadsrc-0cb5357037c0169cb546365878afe601bd2d6c8b.tar.gz
src-0cb5357037c0169cb546365878afe601bd2d6c8b.zip
Import the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime.
KCSAN is a tool to find concurrent memory access that may race each other. After a determined number of memory accesses a cell is created, this describes the current access. It will then delay for a short period to allow other CPUs a chance to race. If another CPU performs a memory access to an overlapping region during this delay the race is reported. This is a straight import of the NetBSD code, it will be adapted to FreeBSD in a future commit. Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/head/; revision=354894
Diffstat (limited to 'sys/sys/csan.h')
-rw-r--r--sys/sys/csan.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/sys/sys/csan.h b/sys/sys/csan.h
new file mode 100644
index 000000000000..d38b656b6a20
--- /dev/null
+++ b/sys/sys/csan.h
@@ -0,0 +1,49 @@
+/* $NetBSD: csan.h,v 1.1 2019/11/05 20:19:18 maxv Exp $ */
+
+/*
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Maxime Villard.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_CSAN_H_
+#define _SYS_CSAN_H_
+
+#ifdef _KERNEL_OPT
+#include "opt_kcsan.h"
+#endif
+
+#include <sys/types.h>
+
+#ifdef KCSAN
+void kcsan_init(void);
+void kcsan_cpu_init(struct cpu_info *);
+#else
+#define kcsan_init() __nothing
+#define kcsan_cpu_init(ci) __nothing
+#endif
+
+#endif /* !_SYS_CSAN_H_ */