Skip to content

Commit e75a698

Browse files
arndbakpm00
authored andcommitted
kmsan: disable ftrace in kmsan core code
objtool warns about some suspicous code inside of kmsan: vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_n+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_n+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_1+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_1+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_2+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_2+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_4+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_4+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_load_8+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_metadata_ptr_for_store_8+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_instrument_asm_store+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_chain_origin+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_poison_alloca+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_warning+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: __msan_get_context_state+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: kmsan_copy_to_user+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: kmsan_unpoison_memory+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: kmsan_unpoison_entry_regs+0x4: call to __fentry__() with UACCESS enabled vmlinux.o: warning: objtool: kmsan_report+0x4: call to __fentry__() with UACCESS enabled The Makefile contained a line to turn off ftrace for the entire directory, but this does not work. Replace it with individual lines, matching the approach in kasan. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]> Fixes: f80be45 ("kmsan: add KMSAN runtime core") Acked-by: Alexander Potapenko <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Kuan-Ying Lee <[email protected]> Cc: Marco Elver <[email protected]> Cc: Peter Zijlstra (Intel) <[email protected]> Cc: Vincenzo Frascino <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 9701c9f commit e75a698

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mm/kmsan/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ CC_FLAGS_KMSAN_RUNTIME := -fno-stack-protector
1414
CC_FLAGS_KMSAN_RUNTIME += $(call cc-option,-fno-conserve-stack)
1515
CC_FLAGS_KMSAN_RUNTIME += -DDISABLE_BRANCH_PROFILING
1616

17-
CFLAGS_REMOVE.o = $(CC_FLAGS_FTRACE)
17+
# Disable ftrace to avoid recursion.
18+
CFLAGS_REMOVE_core.o = $(CC_FLAGS_FTRACE)
19+
CFLAGS_REMOVE_hooks.o = $(CC_FLAGS_FTRACE)
20+
CFLAGS_REMOVE_init.o = $(CC_FLAGS_FTRACE)
21+
CFLAGS_REMOVE_instrumentation.o = $(CC_FLAGS_FTRACE)
22+
CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)
23+
CFLAGS_REMOVE_shadow.o = $(CC_FLAGS_FTRACE)
1824

1925
CFLAGS_core.o := $(CC_FLAGS_KMSAN_RUNTIME)
2026
CFLAGS_hooks.o := $(CC_FLAGS_KMSAN_RUNTIME)

0 commit comments

Comments
 (0)