[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231011132703.3evo4ieradgyvgc2@box.shutemov.name>
Date: Wed, 11 Oct 2023 16:27:03 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
kasan-dev@...glegroups.com, linux-kernel@...r.kernel.org,
Fei Yang <fei.yang@...el.com>, stable@...r.kernel.org
Subject: Re: [PATCHv2] x86/alternatives: Disable KASAN in apply_alternatives()
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?
> > diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> > index 517ee01503be..b4cc4d7c0825 100644
> > --- a/arch/x86/kernel/alternative.c
> > +++ b/arch/x86/kernel/alternative.c
> > @@ -403,6 +403,17 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
> > u8 insn_buff[MAX_PATCH_LEN];
> >
> > DPRINTK(ALT, "alt table %px, -> %px", start, end);
> > +
> > + /*
> > + * 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 and triggers
>
> because of partial LA57 convertion ..
>
> > + * a false-positive out-of-bound report.
> > + *
> > + * Disable KASAN until the patching is complete.
> > + */
> > + kasan_disable_current();
> > +
> > /*
/*
* 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?
If yes, I will submit v3 with your Ack.
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists