Skip to content

Commit cf80164

Browse files
samitolvanenkees
authored andcommitted
cfi: Fix CFI failure with KASAN
When CFI_CLANG and KASAN are both enabled, LLVM doesn't generate a CFI type hash for asan.module_ctor functions in translation units where CFI is disabled, which leads to a CFI failure during boot when do_ctors calls the affected constructors: CFI failure at do_basic_setup+0x64/0x90 (target: asan.module_ctor+0x0/0x28; expected type: 0xa540670c) Specifically, this happens because CFI is disabled for kernel/cfi.c. There's no reason to keep CFI disabled here anymore, so fix the failure by not filtering out CC_FLAGS_CFI for the file. Note that https://reviews.llvm.org/rG3b14862f0a96 fixed the issue where LLVM didn't emit CFI type hashes for any sanitizer constructors, but now type hashes are emitted correctly for TUs that use CFI. Link: ClangBuiltLinux#1742 Fixes: 8924560 ("cfi: Switch to -fsanitize=kcfi") Reported-by: Mark Rutland <[email protected]> Signed-off-by: Sami Tolvanen <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7535b83 commit cf80164

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

kernel/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ UBSAN_SANITIZE_kcov.o := n
4141
KMSAN_SANITIZE_kcov.o := n
4242
CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) -fno-stack-protector
4343

44-
# Don't instrument error handlers
45-
CFLAGS_REMOVE_cfi.o := $(CC_FLAGS_CFI)
46-
4744
obj-y += sched/
4845
obj-y += locking/
4946
obj-y += power/

0 commit comments

Comments
 (0)