[PATCH kcsan 0/29] Kernel Concurrency Sanitizer (KCSAN) updates for v5.17

From: Paul E. McKenney
Date: Tue Dec 14 2021 - 17:04:00 EST


Hello!

This series provides KCSAN updates, courtesy of Marco Elver and Alexander
Potapenko:

1. Refactor reading of instrumented memory, courtesy of Marco Elver.

2. Remove redundant zero-initialization of globals, courtesy of
Marco Elver.

3. Avoid checking scoped accesses from nested contexts, courtesy
of Marco Elver.

4. Add core support for a subset of weak memory modeling, courtesy
of Marco Elver.

5. Add core memory barrier instrumentation functions, courtesy of
Marco Elver.

6. kcsan, kbuild: Add option for barrier instrumentation only,
courtesy of Marco Elver.

7. Call scoped accesses reordered in reports, courtesy of Marco
Elver.

8. Show location access was reordered to, courtesy of Marco Elver.

9. Document modeling of weak memory, courtesy of Marco Elver.

10. test: Match reordered or normal accesses, courtesy of Marco Elver.

11. test: Add test cases for memory barrier instrumentation, courtesy
of Marco Elver.

12. Ignore GCC 11+ warnings about TSan runtime support, courtesy of
Marco Elver.

13. selftest: Add test case to check memory barrier instrumentation,
courtesy of Marco Elver.

14. locking/barriers, kcsan: Add instrumentation for barriers,
courtesy of Marco Elver.

15. locking/barriers, kcsan: Support generic instrumentation,
courtesy of Marco Elver.

16. locking/atomics, kcsan: Add instrumentation for barriers,
courtesy of Marco Elver.

17. asm-generic/bitops, kcsan: Add instrumentation for barriers,
courtesy of Marco Elver.

18. x86/barriers, kcsan: Use generic instrumentation for non-smp
barriers, courtesy of Marco Elver.

19. x86/qspinlock, kcsan: Instrument barrier of
pv_queued_spin_unlock(), courtesy of Marco Elver.

20. mm, kcsan: Enable barrier instrumentation, courtesy of Marco
Elver.

21. sched, kcsan: Enable memory barrier instrumentation, courtesy
of Marco Elver.

22. objtool, kcsan: Add memory barrier instrumentation to whitelist,
courtesy of Marco Elver.

23. objtool, kcsan: Remove memory barrier instrumentation from
noinstr, courtesy of Marco Elver.

24. compiler_attributes.h: Add __disable_sanitizer_instrumentation,
courtesy of Alexander Potapenko.

25. Support WEAK_MEMORY with Clang where no objtool support exists,
courtesy of Marco Elver.

26. Make barrier tests compatible with lockdep, courtesy of Marco
Elver.

27. Turn barrier instrumentation into macros, courtesy of Marco Elver.

28. Avoid nested contexts reading inconsistent reorder_access,
courtesy of Marco Elver.

29. Only test clear_bit_unlock_is_negative_byte if arch defines it,
courtesy of Marco Elver.

Thanx, Paul

------------------------------------------------------------------------

b/Documentation/dev-tools/kcsan.rst | 76 ++-
b/arch/x86/include/asm/barrier.h | 10
b/arch/x86/include/asm/qspinlock.h | 1
b/include/asm-generic/barrier.h | 29 -
b/include/asm-generic/bitops/instrumented-atomic.h | 3
b/include/asm-generic/bitops/instrumented-lock.h | 3
b/include/linux/atomic/atomic-instrumented.h | 135 ++++++
b/include/linux/compiler_attributes.h | 18
b/include/linux/compiler_types.h | 13
b/include/linux/kcsan-checks.h | 10
b/include/linux/kcsan.h | 1
b/include/linux/sched.h | 3
b/include/linux/spinlock.h | 2
b/init/init_task.c | 5
b/kernel/kcsan/Makefile | 2
b/kernel/kcsan/core.c | 51 --
b/kernel/kcsan/kcsan_test.c | 4
b/kernel/kcsan/report.c | 16
b/kernel/kcsan/selftest.c | 141 ++++++
b/kernel/sched/Makefile | 7
b/lib/Kconfig.kcsan | 20
b/mm/Makefile | 2
b/scripts/Makefile.kcsan | 9
b/scripts/Makefile.lib | 5
b/scripts/atomic/gen-atomic-instrumented.sh | 41 +
b/tools/objtool/check.c | 4
b/tools/objtool/include/objtool/elf.h | 2
include/asm-generic/barrier.h | 25 +
include/linux/kcsan-checks.h | 95 +++-
include/linux/kcsan.h | 10
kernel/kcsan/core.c | 302 ++++++++++++-
kernel/kcsan/kcsan_test.c | 456 ++++++++++++++++++---
kernel/kcsan/report.c | 35 +
kernel/kcsan/selftest.c | 22 -
lib/Kconfig.kcsan | 2
scripts/Makefile.kcsan | 6
tools/objtool/check.c | 37 +
37 files changed, 1389 insertions(+), 214 deletions(-)