Re: [PATCH v7 7/7] ARM: Enable KASan for ARM

From: Linus Walleij
Date: Sat Apr 11 2020 - 20:34:18 EST


On Fri, Apr 10, 2020 at 12:45 PM Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:

> > +CFLAGS_KERNEL += -D__SANITIZE_ADDRESS__
(...)
> > - $(call cc-option,-mno-single-pic-base)
> > + $(call cc-option,-mno-single-pic-base) \
> > + -D__SANITIZE_ADDRESS__
>
> I am not too crazy about this need to unconditionally 'enable' KASAN
> on the command line like this, in order to be able to disable it again
> when CONFIG_KASAN=y.
>
> Could we instead add something like this at the top of
> arch/arm/boot/compressed/string.c?
>
> #ifdef CONFIG_KASAN
> #undef memcpy
> #undef memmove
> #undef memset
> void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
> void *__memmove(void *__dest, __const void *__src, size_t count)
> __alias(memmove);
> void *__memset(void *s, int c, size_t count) __alias(memset);
> #endif

I obviously missed this before I sent out my new version of the series.
It bothers me too.

I will try this approach when I prepare the next iteration.

Thanks a lot!

Yours,
Linus Walleij