[GIT PULL kcsan] KCSAN commits for v5.17

From: Paul E. McKenney
Date: Thu Dec 16 2021 - 18:57:16 EST


Hello, Ingo,

This pull request contains updates for the Kernel concurrency sanitizer
(KCSAN). Perhaps the most notable addition is added support for weak
memory ordering, as described here: https://lwn.net/Articles/877200/

These updats have been posted on LKML:

https://lore.kernel.org/all/20211214220356.GA2236323@paulmck-ThinkPad-P17-Gen-1/

These changes are based on v5.16-rc1, have been exposed to -next and to
kbuild test robot, and are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git kcsan

for you to fetch changes up to b473a3891c46393e9c4ccb4e3197d7fb259c7100:

kcsan: Only test clear_bit_unlock_is_negative_byte if arch defines it (2021-12-09 16:42:29 -0800)

If I don't hear from you by Friday of the week prior to the merge window
opening, I will assume that you would prefer that I push this directly
to Linus.

Have a great holiday season!

----------------------------------------------------------------
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(-)