[PATCH v4 7/7] powerpc: kcsan: Add KCSAN Support

Marco Elver elver at google.com
Wed Feb 8 21:10:16 AEDT 2023


On Wed, 8 Feb 2023 at 04:23, Rohan McLure <rmclure at linux.ibm.com> wrote:
>
> Enable HAVE_ARCH_KCSAN on all powerpc platforms, permitting use of the
> kernel concurrency sanitiser through the CONFIG_KCSAN_* kconfig options.
> KCSAN requires compiler builtins __atomic_* 64-bit values, and so only
> report support on PPC64.

I thought the stubs solve that?

In general the whole builtin atomic support is only there to support
some odd corner cases today (Clang GCOV generates builtin atomic ops,
occasionally some driver sneaks in a builtin atomic although it's
technically strongly discouraged, and probably Rust stuff in future).
So I'd like to keep them, although they shouldn't cause issues.

> See documentation in Documentation/dev-tools/kcsan.rst for more
> information.

Do the tests pass?

> Signed-off-by: Rohan McLure <rmclure at linux.ibm.com>
> ---
> v3: Restrict support to 64-bit, as TSAN expects 64-bit __atomic_* compiler
> built-ins.
> ---
>  arch/powerpc/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index b8c4ac56bddc..55bc2d724c73 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -198,6 +198,7 @@ config PPC
>         select HAVE_ARCH_KASAN                  if PPC_RADIX_MMU
>         select HAVE_ARCH_KASAN                  if PPC_BOOK3E_64
>         select HAVE_ARCH_KASAN_VMALLOC          if HAVE_ARCH_KASAN
> +       select HAVE_ARCH_KCSAN            if PPC64
>         select HAVE_ARCH_KFENCE                 if ARCH_SUPPORTS_DEBUG_PAGEALLOC
>         select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
>         select HAVE_ARCH_KGDB
> --
> 2.37.2
>


More information about the Linuxppc-dev mailing list