[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250630143934.15284Caf-hca@linux.ibm.com>
Date: Mon, 30 Jun 2025 16:39:34 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
To: Alexander Gordeev <agordeev@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>
Cc: Sabyrzhan Tasbolatov <snovitoll@...il.com>, ryabinin.a.a@...il.com,
glider@...gle.com, andreyknvl@...il.com, dvyukov@...gle.com,
vincenzo.frascino@....com, linux@...linux.org.uk,
catalin.marinas@....com, will@...nel.org, chenhuacai@...nel.org,
kernel@...0n.name, maddy@...ux.ibm.com, mpe@...erman.id.au,
npiggin@...il.com, christophe.leroy@...roup.eu,
paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
alex@...ti.fr, gor@...ux.ibm.com, borntraeger@...ux.ibm.com,
svens@...ux.ibm.com, richard@....at, anton.ivanov@...bridgegreys.com,
johannes@...solutions.net, dave.hansen@...ux.intel.com,
luto@...nel.org, peterz@...radead.org, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, x86@...nel.org, hpa@...or.com,
chris@...kel.net, jcmvbkbc@...il.com, akpm@...ux-foundation.org,
nathan@...nel.org, nick.desaulniers+lkml@...il.com, morbo@...gle.com,
justinstitt@...gle.com, arnd@...db.de, rppt@...nel.org,
geert@...ux-m68k.org, mcgrof@...nel.org, guoweikang.kernel@...il.com,
tiwei.btw@...group.com, kevin.brodsky@....com, benjamin.berg@...el.com,
kasan-dev@...glegroups.com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, loongarch@...ts.linux.dev,
linuxppc-dev@...ts.ozlabs.org, linux-riscv@...ts.infradead.org,
linux-s390@...r.kernel.org, linux-um@...ts.infradead.org,
linux-mm@...ck.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v2 01/11] kasan: unify static kasan_flag_enabled across
modes
On Mon, Jun 30, 2025 at 02:31:00PM +0200, Alexander Gordeev wrote:
> On Thu, Jun 26, 2025 at 08:31:37PM +0500, Sabyrzhan Tasbolatov wrote:
>
> Hi Sabyrzhan,
>
> > diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> > index d54e89f8c3e..32c432df24a 100644
> > --- a/mm/kasan/generic.c
> > +++ b/mm/kasan/generic.c
> > @@ -36,6 +36,17 @@
> > #include "kasan.h"
> > #include "../slab.h"
> >
> > +/*
> > + * Initialize Generic KASAN and enable runtime checks.
> > + * This should be called from arch kasan_init() once shadow memory is ready.
> > + */
> > +void __init kasan_init_generic(void)
> > +{
> > + static_branch_enable(&kasan_flag_enabled);
>
> s390 crashes at this line, when the whole series is applied.
>
> FWIW, it looks like kasan is called while its state is not yet finalized.
> E.g. whether calling __asan_report_store4_noabort() before kasan_init_generic()
> is expected?
It crashes because with this conversion a call to static_branch_enable() is
introduced. This one get's called way before jump_label_init() init has been
called. Therefore the STATIC_KEY_CHECK_USE() in static_key_enable_cpuslocked()
triggers.
This again tries to emit a warning. Due to lack of console support that early
the kernel crashes.
One possible solution would be to move the kasan init function to
arch/s390/kernel/setup.c, after jump_label_init() has been called.
If we want this, is a different question.
It seems to work, so I see no reason for not doing that.
Vasily, since you did nearly all of the KASAN work for s390, do you have any
opinion about this?
Powered by blists - more mailing lists