linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/7] powerpc: Add KCSAN Support
@ 2023-02-08  3:21 Rohan McLure
  2023-02-08  3:21 ` [PATCH v4 1/7] kcsan: Add atomic builtin stubs for 32-bit systems Rohan McLure
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Rohan McLure @ 2023-02-08  3:21 UTC (permalink / raw)
  To: linuxppc-dev, linux-xtensa; +Cc: chris, elver, npiggin, jcmvbkbc, Rohan McLure

Add Kernel Concurrency Sanitiser support for PPC64. Doing so involves
exclusion of a number of compilation units from instrumentation, as was
done with KASAN.

KCSAN uses watchpoints on memory accesses to enforce the semantics of
the Linux kernel memory model, notifying the user of observed data races
which have not been declared to be intended in source through the
data_race() macro, in order to remove false positives.

A number of such race conditions are identified. This patch series
provides support for the instrumentation, with bug fixes as well as
removal of false positives to be issued in future patches.

As of v4, provide stubs for __atomic_* builtins for 8-byte values
for 32-bit systems without toolchain support. This generalises xtensa's
stubs, and causes xtensa to use generic implementation.

v3: Restrict support to PPC64 as kcsan code expects support for
__atomic* builtins for 64-bit atomic types.
Link: https://lore.kernel.org/linuxppc-dev/449b9d60-18f6-ebf3-9878-ae54a61d1e49@csgroup.eu/

v2: Implement __smp_mb() in terms of __mb() to avoid multiple calls to
kcsan_mb().
Link: https://lore.kernel.org/linuxppc-dev/20230201043438.1301212-4-rmclure@linux.ibm.com/

v1: https://lore.kernel.org/linuxppc-dev/20230131234859.1275125-1-rmclure@linux.ibm.com/

Rohan McLure (7):
  kcsan: Add atomic builtin stubs for 32-bit systems
  xtensa: kcsan: Remove kcsan stubs for atomic builtins
  powerpc: kcsan: Add exclusions from instrumentation
  powerpc: kcsan: Exclude udelay to prevent recursive instrumentation
  powerpc: kcsan: Memory barriers semantics
  powerpc: kcsan: Prevent recursive instrumentation with IRQ
    save/restores
  powerpc: kcsan: Add KCSAN Support

 arch/powerpc/Kconfig                          |  1 +
 arch/powerpc/include/asm/barrier.h            | 12 ++++-----
 arch/powerpc/kernel/Makefile                  | 10 +++++++
 arch/powerpc/kernel/irq_64.c                  |  6 ++---
 arch/powerpc/kernel/time.c                    |  4 +--
 arch/powerpc/kernel/trace/Makefile            |  1 +
 arch/powerpc/kernel/vdso/Makefile             |  1 +
 arch/powerpc/lib/Makefile                     |  2 ++
 arch/powerpc/purgatory/Makefile               |  1 +
 arch/powerpc/xmon/Makefile                    |  1 +
 arch/xtensa/lib/Makefile                      |  1 -
 kernel/kcsan/Makefile                         |  2 +-
 .../lib/kcsan-stubs.c => kernel/kcsan/stubs.c | 26 ++++++++++++++++++-
 13 files changed, 54 insertions(+), 14 deletions(-)
 rename arch/xtensa/lib/kcsan-stubs.c => kernel/kcsan/stubs.c (58%)

-- 
2.37.2


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-02-09 23:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-08  3:21 [PATCH v4 0/7] powerpc: Add KCSAN Support Rohan McLure
2023-02-08  3:21 ` [PATCH v4 1/7] kcsan: Add atomic builtin stubs for 32-bit systems Rohan McLure
2023-02-08  4:23   ` Max Filippov
2023-02-08 12:23   ` Christophe Leroy
2023-02-08 23:14     ` Rohan McLure
2023-02-09 23:36       ` Rohan McLure
2023-02-08  3:21 ` [PATCH v4 2/7] xtensa: kcsan: Remove kcsan stubs for atomic builtins Rohan McLure
2023-02-08  4:24   ` Max Filippov
2023-02-08  3:21 ` [PATCH v4 3/7] powerpc: kcsan: Add exclusions from instrumentation Rohan McLure
2023-02-08  3:21 ` [PATCH v4 4/7] powerpc: kcsan: Exclude udelay to prevent recursive instrumentation Rohan McLure
2023-02-08  3:22 ` [PATCH v4 5/7] powerpc: kcsan: Memory barriers semantics Rohan McLure
2023-02-08  3:22 ` [PATCH v4 6/7] powerpc: kcsan: Prevent recursive instrumentation with IRQ save/restores Rohan McLure
2023-02-08  3:22 ` [PATCH v4 7/7] powerpc: kcsan: Add KCSAN Support Rohan McLure
2023-02-08 10:10   ` Marco Elver
2023-02-08 12:25   ` Christophe Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).