mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com,
	kernel-team@fb.com, mingo@kernel.org
Cc: elver@google.com, andreyknvl@google.com, glider@google.com,
	dvyukov@google.com, cai@lca.pw, boqun.feng@gmail.com,
	"Paul E . McKenney" <paulmck@kernel.org>
Subject: [PATCH kcsan 06/29] kcsan, kbuild: Add option for barrier instrumentation only
Date: Tue, 14 Dec 2021 14:04:16 -0800	[thread overview]
Message-ID: <20211214220439.2236564-6-paulmck@kernel.org> (raw)
In-Reply-To: <20211214220356.GA2236323@paulmck-ThinkPad-P17-Gen-1>

From: Marco Elver <elver@google.com>

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>
---
 scripts/Makefile.lib | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index d1f865b8c0cba..ab17f7b2e33c4 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
-- 
2.31.1.189.g2e36527f23


  parent reply	other threads:[~2021-12-14 22:05 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 22:03 [PATCH kcsan 0/29] Kernel Concurrency Sanitizer (KCSAN) updates for v5.17 Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 01/29] kcsan: Refactor reading of instrumented memory Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 02/29] kcsan: Remove redundant zero-initialization of globals Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 03/29] kcsan: Avoid checking scoped accesses from nested contexts Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 04/29] kcsan: Add core support for a subset of weak memory modeling Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 05/29] kcsan: Add core memory barrier instrumentation functions Paul E. McKenney
2021-12-14 22:04 ` Paul E. McKenney [this message]
2021-12-14 22:04 ` [PATCH kcsan 07/29] kcsan: Call scoped accesses reordered in reports Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 08/29] kcsan: Show location access was reordered to Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 09/29] kcsan: Document modeling of weak memory Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 10/29] kcsan: test: Match reordered or normal accesses Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 11/29] kcsan: test: Add test cases for memory barrier instrumentation Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 12/29] kcsan: Ignore GCC 11+ warnings about TSan runtime support Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 13/29] kcsan: selftest: Add test case to check memory barrier instrumentation Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 14/29] locking/barriers, kcsan: Add instrumentation for barriers Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 15/29] locking/barriers, kcsan: Support generic instrumentation Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 16/29] locking/atomics, kcsan: Add instrumentation for barriers Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 17/29] asm-generic/bitops, " Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 18/29] x86/barriers, kcsan: Use generic instrumentation for non-smp barriers Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 19/29] x86/qspinlock, kcsan: Instrument barrier of pv_queued_spin_unlock() Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 20/29] mm, kcsan: Enable barrier instrumentation Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 21/29] sched, kcsan: Enable memory " Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 22/29] objtool, kcsan: Add memory barrier instrumentation to whitelist Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 23/29] objtool, kcsan: Remove memory barrier instrumentation from noinstr Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 24/29] compiler_attributes.h: Add __disable_sanitizer_instrumentation Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 25/29] kcsan: Support WEAK_MEMORY with Clang where no objtool support exists Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 26/29] kcsan: Make barrier tests compatible with lockdep Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 27/29] kcsan: Turn barrier instrumentation into macros Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 28/29] kcsan: Avoid nested contexts reading inconsistent reorder_access Paul E. McKenney
2021-12-14 22:04 ` [PATCH kcsan 29/29] kcsan: Only test clear_bit_unlock_is_negative_byte if arch defines it Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211214220439.2236564-6-paulmck@kernel.org \
    --to=paulmck@kernel.org \
    --cc=andreyknvl@google.com \
    --cc=boqun.feng@gmail.com \
    --cc=cai@lca.pw \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®