Re: [PATCH] kasan: Fix tests by removing -ffreestanding
From: Andrey Konovalov
Date: Wed Jul 12 2023 - 12:13:32 EST
On Wed, Jul 12, 2023 at 12:14 PM Huacai Chen <chenhuacai@xxxxxxxxxxx> wrote:
>
> CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX hopes -fbuiltin for memset()/
> memcpy()/memmove() if instrumentation is needed. This is the default
> behavior but some archs pass -ffreestanding which implies -fno-builtin,
> and then causes some kasan tests fail. So we remove -ffreestanding for
> kasan tests.
Could you clarify on which architecture you observed tests failures?
>
> Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
> ---
> mm/kasan/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
> index 7634dd2a6128..edd1977a6b88 100644
> --- a/mm/kasan/Makefile
> +++ b/mm/kasan/Makefile
> @@ -45,7 +45,9 @@ CFLAGS_KASAN_TEST += -fno-builtin
> endif
>
> CFLAGS_kasan_test.o := $(CFLAGS_KASAN_TEST)
> +CFLAGS_REMOVE_kasan_test.o := -ffreestanding
> CFLAGS_kasan_test_module.o := $(CFLAGS_KASAN_TEST)
> +CFLAGS_REMOVE_kasan_test_module.o := -ffreestanding
>
> obj-y := common.o report.o
> obj-$(CONFIG_KASAN_GENERIC) += init.o generic.o report_generic.o shadow.o quarantine.o
> --
> 2.39.3
+Marco