UBSan: Allow custom the sanitizer in Kconfig
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
27fbca771f
commit
32a21a1b67
|
@ -84,7 +84,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -170,7 +170,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -125,7 +125,7 @@ ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -90,7 +90,7 @@ ifeq ($(CONFIG_ARMV7M_STACKCHECK),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -101,7 +101,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -90,7 +90,7 @@ ifeq ($(CONFIG_ARMV8M_STACKCHECK),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -63,7 +63,7 @@ ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -167,7 +167,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -48,7 +48,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -48,7 +48,7 @@ ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -78,9 +78,9 @@ else ifeq ($(CONFIG_MM_KASAN_ALL),y)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SIM_UBSAN),y)
|
ifeq ($(CONFIG_SIM_UBSAN),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
else ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
else ifeq ($(CONFIG_MM_UBSAN_ALL),y)
|
||||||
ARCHOPTIMIZATION += -fsanitize=undefined
|
ARCHOPTIMIZATION += $(CONFIG_MM_UBSAN_OPTION)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
ifeq ($(CONFIG_MM_UBSAN_TRAP_ON_ERROR),y)
|
||||||
|
|
|
@ -222,6 +222,15 @@ config MM_UBSAN_ALL
|
||||||
will get image size increased and performance decreased
|
will get image size increased and performance decreased
|
||||||
significantly.
|
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
|
config MM_UBSAN_TRAP_ON_ERROR
|
||||||
bool "Enable UBsan trap on error to crash immediately"
|
bool "Enable UBsan trap on error to crash immediately"
|
||||||
depends on MM_UBSAN
|
depends on MM_UBSAN
|
||||||
|
|
Loading…
Reference in New Issue