kasan: disable the built-in 'memset' function

In function kasan_set_poison:
{
  ...

  while (size--)
    {
      p[size] = value;
    }
}
This will optimize to 'memset' function when compile option > O2.

But the memset must be instrument by kasan, so there is recursive

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2024-03-27 10:58:40 +08:00 committed by Xiang Xiao
parent 8a272511d5
commit 13a0682340
2 changed files with 3 additions and 0 deletions

View File

@ -25,6 +25,7 @@ if(CONFIG_MM_KASAN)
list(APPEND SRCS generic.c)
set_source_files_properties(generic.c PROPERTIES COMPILE_FLAGS
-fno-sanitize=kernel-address)
set_source_files_properties(generic.c PROPERTIES COMPILE_FLAGS -fno-builtin)
set_source_files_properties(generic.c PROPERTIES COMPILE_FLAGS -fno-lto)
endif()

View File

@ -43,6 +43,8 @@ ifeq ($(CONFIG_MM_KASAN),y)
endif
endif
CFLAGS += -fno-builtin
# Add the core heap directory to the build
DEPPATH += --dep-path kasan