Re: [PATCH 4/4] x86/percpu: Use C for percpu read/write accessors

From: Ingo Molnar
Date: Mon Oct 09 2023 - 07:52:03 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

>
> * Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> > index ecb256954351..1edf4a5b93ca 100644
> > --- a/arch/x86/Kconfig
> > +++ b/arch/x86/Kconfig
> > @@ -2393,7 +2393,7 @@ config CC_HAS_NAMED_AS
> >
> > config USE_X86_SEG_SUPPORT
> > def_bool y
> > - depends on CC_HAS_NAMED_AS && SMP
> > + depends on CC_HAS_NAMED_AS && SMP && !KASAN
> > + depends on CC_HAS_NAMED_AS && SMP && !KASAN
>
> So I'd rather express this as a Kconfig quirk line, and explain each quirk.
>
> Something like:
>
> depends on CC_HAS_NAMED_AS
> depends on SMP
> #
> # -fsanitize=kernel-address (KASAN) is at the moment incompatible
> # with named address spaces - see GCC bug #12345.
> #
> depends on !KASAN
>
> ... or so.

BTW., while this OK for testing, this is too heavy handed for release
purposes, so please only disable the KASAN instrumentation for the affected
percpu accessors.

See the various __no_sanitize* attributes available.

I'd even suggest introducing a new attribute variant, specific to x86,
prefixed with __no_sanitize_x86_seg or so, which would allow the eventual
KASAN-instrumentation of the percpu accessors once the underlying GCC bug
is fixed.

Thanks,

Ingo