UBSan: Allow custom the sanitizer in Kconfig

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2022-09-02 04:42:45 +00:00 committed by Xiang Xiao
parent 27fbca771f
commit 32a21a1b67
12 changed files with 21 additions and 12 deletions

View File

@ -84,7 +84,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -170,7 +170,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -125,7 +125,7 @@ ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -90,7 +90,7 @@ ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -101,7 +101,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -90,7 +90,7 @@ ifeq ($(CONFIG_ARMV8M_STACKCHECK),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -63,7 +63,7 @@ ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -167,7 +167,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -48,7 +48,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -48,7 +48,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
endif
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -78,9 +78,9 @@ else ifeq ($(CONFIG_MM_KASAN_ALL),y)
endif
ifeq ($(CONFIG_SIM_UBSAN),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
else ifeq ($(CONFIG_MM_UBSAN_ALL),y)
ARCHOPTIMIZATION += -fsanitize=undefined
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
endif
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)

View File

@ -222,6 +222,15 @@ config MM_UBSAN_ALL
will get image size increased and performance decreased
significantly.
config MM_UBSAN_OPTION
string "UBSan options"
depends on MM_UBSAN
default "-fsanitize=undefined"
---help---
This option activates specified UBSan instrumentation. Please
refer to https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
for available options.
config MM_UBSAN_TRAP_ON_ERROR
bool "Enable UBsan trap on error to crash immediately"
depends on MM_UBSAN