[PATCH v3] kasan: remove redundant config option

Andrey Konovalov andreyknvl at google.com
Mon Jan 11 12:40:07 EST 2021


On Fri, Jan 8, 2021 at 9:31 PM Arnd Bergmann <arnd at kernel.org> wrote:
>
> On Fri, Jan 8, 2021 at 7:56 PM Andrey Konovalov <andreyknvl at google.com> wrote:
> > On Fri, Jan 8, 2021 at 5:09 AM Walter Wu <walter-zh.wu at mediatek.com> wrote:
>
> > > @@ -2,6 +2,12 @@
> > >  CFLAGS_KASAN_NOSANITIZE := -fno-builtin
> > >  KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
> > >
> > > +ifdef CONFIG_KASAN_STACK
> > > +       stack_enable := 1
> > > +else
> > > +       stack_enable := 0
> > > +endif
> > > +
> >
> > AFAIR, Arnd wanted to avoid having KASAN_STACK to be enabled by
> > default when compiling with Clang, since Clang instrumentation leads
> > to very large kernel stacks, which, in turn, lead to compile-time
> > warnings. What I don't remember is why there are two configs.
> >
> > Arnd, is that correct? What was the reason behind having two configs?
>
> I think I just considered it cleaner than defining the extra variable in the
> Makefile at the time, as this was the only place that referenced
> CONFIG_KASAN_STACK.
>
> The '#if CONFIG_KASAN_STACK' (rather than #ifdef) that got added
> later do make my version more confusing though, so I agree that
> Walter's second patch improves it.
>
> Acked-by: Arnd Bergmann <arnd at arndb.de>

Got it, thanks!

> On a related note: do you have any hope that clang will ever fix
> https://bugs.llvm.org/show_bug.cgi?id=38809 and KASAN_STACK
> can be enabled by default on clang without risking stack
> overflows?

Not sure :(

I've filed this on KASAN bugzilla to not forget:
https://bugzilla.kernel.org/show_bug.cgi?id=211139



More information about the linux-arm-kernel mailing list