Re: [PATCHv2] x86/alternatives: Disable KASAN in apply_alternatives()

From: Ingo Molnar
Date: Wed Oct 11 2023 - 16:45:43 EST



* Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> wrote:

> On Wed, Oct 11, 2023 at 09:46:16AM +0200, Peter Zijlstra wrote:
> > On Wed, Oct 11, 2023 at 09:58:49AM +0300, Kirill A. Shutemov wrote:
> > > Fei has reported that KASAN triggers during apply_alternatives() on
> > > 5-level paging machine:
> > >
> >
> > Urgh @ KASAN splat, can't we summarize that?
>
> What about this?
>
> BUG: KASAN: out-of-bounds in rcu_is_watching
> Read of size 4 at addr ff110003ee6419a0 by task swapper/0/0
> ...
> __asan_load4
> rcu_is_watching
> ? text_poke_early
> trace_hardirqs_on
> ? __asan_load4
> text_poke_early
> apply_alternatives
> ...
>
> Is it enough details or I overdid summarization?

No, that's perfect IMO. I'd even leave out the unreliable '?' entries:

> BUG: KASAN: out-of-bounds in rcu_is_watching
> Read of size 4 at addr ff110003ee6419a0 by task swapper/0/0
> ...
> __asan_load4
> rcu_is_watching
> trace_hardirqs_on
> text_poke_early
> apply_alternatives
> ...

... or so.

> /*
> * In the case CONFIG_X86_5LEVEL=y, KASAN_SHADOW_START is defined using
> * cpu_feature_enabled(X86_FEATURE_LA57) and is therefore patched here.
> * During the process, KASAN becomes confused seeing partial LA57
> * conversion and triggers a false-positive out-of-bound report.
> *
> * Disable KASAN until the patching is complete.
> */
>
> Looks good?

LGTM.

Thanks,

Ingo