History

kcsan: Add Kernel Concurrency Sanitizer infrastructure

Kernel Concurrency Sanitizer (KCSAN) is a dynamic data-race detector for kernel space. KCSAN is a sampling watchpoint-based data-race detector. See the included Documentation/dev-tools/kcsan.rst for more details. This patch adds basic infrastructure, but does not yet enable KCSAN for any architecture.

Marco Elver committed 7 years ago

Commit dfd402a1 parent 31f4f5b24 files · +2006 −9Browse files

Showing the changes to scripts (2 of 24 files). Show all

Unified · Split

2 files
  1. scripts/Makefile.kcsan +6 −0
  2. scripts/Makefile.lib +10 −0
scripts/Makefile.kcsan+6−0
@@ -0,0 +1,6 @@
1+# SPDX-License-Identifier: GPL-2.0
2+ifdef CONFIG_KCSAN
3+
4+CFLAGS_KCSAN := -fsanitize=thread
5+
6+endif # CONFIG_KCSAN
scripts/Makefile.lib+10−0
@@ -152,6 +152,16 @@ _c_flags += $(if $(patsubst n%,, \ · 151 unmodified lines
152152 $(CFLAGS_KCOV))
153153 endif
154154
155+#
156+# Enable KCSAN flags except some files or directories we don't want to check
157+# (depends on variables KCSAN_SANITIZE_obj.o, KCSAN_SANITIZE)
158+#
159+ifeq ($(CONFIG_KCSAN),y)
160+_c_flags += $(if $(patsubst n%,, \
161+ $(KCSAN_SANITIZE_$(basetarget).o)$(KCSAN_SANITIZE)y), \
162+ $(CFLAGS_KCSAN))
163+endif
164+
155165 # $(srctree)/$(src) for including checkin headers from generated source files
156166 # $(objtree)/$(obj) for including generated headers from checkin source files
157167 ifeq ($(KBUILD_EXTMOD),)