mm/kasan: Add MM_KASAN_ALL option
so the user could disable the full image instrumentation, but enable the instrumentation by files or directories. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
f3f1dde39b
commit
f1355680ca
|
@ -79,7 +79,7 @@ ifeq ($(CONFIG_ARCH_COVERAGE),y)
|
|||
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ endif
|
|||
|
||||
# Architecture flags
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ else
|
|||
ARCHCPUFLAGS += -mfloat-abi=soft
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ ifeq ($(CONFIG_ENDIAN_BIG),y)
|
|||
ARCHCPUFLAGS += -mbig-endian
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ endif
|
|||
|
||||
# Architecture flags
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)
|
|||
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ endif
|
|||
|
||||
ARCHCPUFLAGS = -mlongcalls
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ endif
|
|||
|
||||
ARCHCPUFLAGS = -mlongcalls
|
||||
|
||||
ifeq ($(CONFIG_MM_KASAN),y)
|
||||
ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ endif
|
|||
|
||||
ifeq ($(CONFIG_SIM_ASAN),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=address
|
||||
else ifeq ($(CONFIG_MM_KASAN),y)
|
||||
else ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||
ARCHOPTIMIZATION += -fsanitize=kernel-address
|
||||
endif
|
||||
|
||||
|
|
11
mm/Kconfig
11
mm/Kconfig
|
@ -191,6 +191,17 @@ config MM_KASAN
|
|||
bugs in native code. After turn on this option, Please
|
||||
add -fsanitize=kernel-address to CFLAGS/CXXFLAGS too.
|
||||
|
||||
config MM_KASAN_ALL
|
||||
bool "Enable KASan for the entire image"
|
||||
depends on MM_KASAN
|
||||
default y
|
||||
---help---
|
||||
This option activates address sanitizer for the entire image.
|
||||
If you don't enable this option, you have to explicitly specify
|
||||
"-fsanitize=kernel-address" for the files/directories you want
|
||||
to check. Enabling this option will get image size increased
|
||||
and performance decreased significantly.
|
||||
|
||||
config MM_UBSAN
|
||||
bool "Undefined Behavior Sanitizer"
|
||||
default n
|
||||
|
|
Loading…
Reference in New Issue