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.
Showing the changes to scripts (2 of 24 files). Show all
Unified · Split
| @@ -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 | |
| @@ -152,6 +152,16 @@ _c_flags += $(if $(patsubst n%,, \ · 151 unmodified lines | ||
| 152 | 152 | $(CFLAGS_KCOV)) |
| 153 | 153 | endif |
| 154 | 154 | |
| 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 | + | |
| 155 | 165 | # $(srctree)/$(src) for including checkin headers from generated source files |
| 156 | 166 | # $(objtree)/$(obj) for including generated headers from checkin source files |
| 157 | 167 | ifeq ($(KBUILD_EXTMOD),) |