mm: kasan: mark file report so ftrace doesn't trace it
Subsystems (2)
PATCH 1/1 mm: kasan: mark file report so ftrace doesn't trace it
__kasan_report() triggers ftrace and the preempt_count() in ftrace causes a call to __asan_load4(), breaking the circular dependency by making report as no trace for ftrace.
--- mm/kasan/Makefile | 3 +++ 1 file changed, 3 insertions(+)
mm/kasan/Makefile +3 -0
@@ -3,12 +3,14 @@ KASAN_SANITIZE := n UBSAN_SANITIZE_common.o := n UBSAN_SANITIZE_generic.o := n UBSAN_SANITIZE_generic_report.o := n +UBSAN_SANITIZE_report.o := n UBSAN_SANITIZE_tags.o := n KCOV_INSTRUMENT := n CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_generic.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_generic_report.o = $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE) # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
@@ -17,6 +19,7 @@ CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE) CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) +CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) obj-$(CONFIG_KASAN) := common.o init.o report.o
Signature · 1 line
2.20.1
Quoted 30 lines · Anders Roxell
__kasan_report()triggers ftrace and thepreempt_count()in ftrace causes a call to__asan_load4(), breaking the circular dependency by making report as no trace for ftrace.Signed-off-by Anders Roxell <[email protected]>--- mm/kasan/Makefile | 3 +++ 1 file changed, 3 insertions(+)mm/kasan/Makefile +2
-0@@ -3,12 +3,14 @@ KASAN_SANITIZE := n UBSAN_SANITIZE_common.o := n UBSAN_SANITIZE_generic.o := n UBSAN_SANITIZE_generic_report.o := n +UBSAN_SANITIZE_report.o := n UBSAN_SANITIZE_tags.o := n KCOV_INSTRUMENT := n CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_generic.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_generic_report.o = $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE) CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE) # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
mm/kasan/Makefile CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE) · line 25
Quoted 7 lines
mm/kasan/Makefile +1
-0@@ -17,6 +19,7 @@ CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE) CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) +CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) obj-$(CONFIG_KASAN) := common.o init.o report.o
Is it needed in all section? Or you just followed the pattern? Different flag changes were initially done on very specific files for specific reasons. E.g. -fno-conserve-stack is only for performance reasons, so report* should not be there. But I see Peter already added generic_report.o there. Perhaps we need to give up on selective per-file changes, because this causes constant flow of new bugs in the absence of testing and just do something like:
KASAN_SANITIZE := nKCOV_INSTRUMENT := nUBSAN_SANITIZE := nCFLAGS_REMOVE = $(CC_FLAGS_FTRACE)
CFLAGS := $(call cc-option, -fno-conserve-stack -fno-stack-protector)