diff options
author | Marco Elver <elver@google.com> | 2021-11-30 12:44:14 +0100 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2021-12-10 01:42:26 +0100 |
commit | 48c9e28e1e249c97bcbf68451947649c55b8c09e (patch) | |
tree | 44a91fc9e807de5a04197b68565ea4416898336d /scripts/Makefile.lib | |
parent | kcsan: Add core memory barrier instrumentation functions (diff) | |
download | linux-48c9e28e1e249c97bcbf68451947649c55b8c09e.tar.xz linux-48c9e28e1e249c97bcbf68451947649c55b8c09e.zip |
kcsan, kbuild: Add option for barrier instrumentation only
Source files that disable KCSAN via KCSAN_SANITIZE := n, remove all
instrumentation, including explicit barrier instrumentation. With
instrumentation for memory barriers, in few places it is required to
enable just the explicit instrumentation for memory barriers to avoid
false positives.
Providing the Makefile variable KCSAN_INSTRUMENT_BARRIERS_obj.o or
KCSAN_INSTRUMENT_BARRIERS (for all files) set to 'y' only enables the
explicit barrier instrumentation.
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | scripts/Makefile.lib | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index d1f865b8c0cb..ab17f7b2e33c 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -182,6 +182,11 @@ ifeq ($(CONFIG_KCSAN),y) _c_flags += $(if $(patsubst n%,, \ $(KCSAN_SANITIZE_$(basetarget).o)$(KCSAN_SANITIZE)y), \ $(CFLAGS_KCSAN)) +# Some uninstrumented files provide implied barriers required to avoid false +# positives: set KCSAN_INSTRUMENT_BARRIERS for barrier instrumentation only. +_c_flags += $(if $(patsubst n%,, \ + $(KCSAN_INSTRUMENT_BARRIERS_$(basetarget).o)$(KCSAN_INSTRUMENT_BARRIERS)n), \ + -D__KCSAN_INSTRUMENT_BARRIERS__) endif # $(srctree)/$(src) for including checkin headers from generated source files |