[GIT PULL] KCSAN changes for v5.17

From: Paul E. McKenney
Date: Mon Jan 10 2022 - 15:11:16 EST


Hello, Linus,

Please pull the latest KCSAN git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git tags/kcsan.2022.01.09a
# HEAD: b473a3891c46393e9c4ccb4e3197d7fb259c7100: kcsan: Only test clear_bit_unlock_is_negative_byte if arch defines it

KCSAN changes for this cycle provide KCSAN fixes and also the ability to
take memory barriers into account for weakly-ordered systems. This last
can increase the probability of detecting certain types of data races.

----------------------------------------------------------------
Alexander Potapenko (1):
compiler_attributes.h: Add __disable_sanitizer_instrumentation

Marco Elver (28):
kcsan: Refactor reading of instrumented memory
kcsan: Remove redundant zero-initialization of globals
kcsan: Avoid checking scoped accesses from nested contexts
kcsan: Add core support for a subset of weak memory modeling
kcsan: Add core memory barrier instrumentation functions
kcsan, kbuild: Add option for barrier instrumentation only
kcsan: Call scoped accesses reordered in reports
kcsan: Show location access was reordered to
kcsan: Document modeling of weak memory
kcsan: test: Match reordered or normal accesses
kcsan: test: Add test cases for memory barrier instrumentation
kcsan: Ignore GCC 11+ warnings about TSan runtime support
kcsan: selftest: Add test case to check memory barrier instrumentation
locking/barriers, kcsan: Add instrumentation for barriers
locking/barriers, kcsan: Support generic instrumentation
locking/atomics, kcsan: Add instrumentation for barriers
asm-generic/bitops, kcsan: Add instrumentation for barriers
x86/barriers, kcsan: Use generic instrumentation for non-smp barriers
x86/qspinlock, kcsan: Instrument barrier of pv_queued_spin_unlock()
mm, kcsan: Enable barrier instrumentation
sched, kcsan: Enable memory barrier instrumentation
objtool, kcsan: Add memory barrier instrumentation to whitelist
objtool, kcsan: Remove memory barrier instrumentation from noinstr
kcsan: Support WEAK_MEMORY with Clang where no objtool support exists
kcsan: Make barrier tests compatible with lockdep
kcsan: Turn barrier instrumentation into macros
kcsan: Avoid nested contexts reading inconsistent reorder_access
kcsan: Only test clear_bit_unlock_is_negative_byte if arch defines it

Documentation/dev-tools/kcsan.rst | 76 +++-
arch/x86/include/asm/barrier.h | 10 +-
arch/x86/include/asm/qspinlock.h | 1 +
include/asm-generic/barrier.h | 54 ++-
include/asm-generic/bitops/instrumented-atomic.h | 3 +
include/asm-generic/bitops/instrumented-lock.h | 3 +
include/linux/atomic/atomic-instrumented.h | 135 ++++++-
include/linux/compiler_attributes.h | 18 +
include/linux/compiler_types.h | 13 +-
include/linux/kcsan-checks.h | 83 ++++-
include/linux/kcsan.h | 11 +-
include/linux/sched.h | 3 +
include/linux/spinlock.h | 2 +-
init/init_task.c | 5 -
kernel/kcsan/Makefile | 2 +
kernel/kcsan/core.c | 347 +++++++++++++++---
kernel/kcsan/kcsan_test.c | 426 +++++++++++++++++++++--
kernel/kcsan/report.c | 51 +--
kernel/kcsan/selftest.c | 143 ++++++++
kernel/sched/Makefile | 7 +-
lib/Kconfig.kcsan | 20 ++
mm/Makefile | 2 +
scripts/Makefile.kcsan | 15 +-
scripts/Makefile.lib | 5 +
scripts/atomic/gen-atomic-instrumented.sh | 41 ++-
tools/objtool/check.c | 41 ++-
tools/objtool/include/objtool/elf.h | 2 +-
27 files changed, 1347 insertions(+), 172 deletions(-)