summaryrefslogtreecommitdiff
path: root/scripts/Makefile.modfinal
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2023-06-23 03:11:43 +0300
committerMasahiro Yamada <masahiroy@kernel.org>2023-06-25 17:12:20 +0300
commit25a21fbb934a0d989e1858f83c2ddf4cfb2ebe30 (patch)
tree82277e8c4a4eecad173436a580441a6f1bf0b20f /scripts/Makefile.modfinal
parentddf56288eebd1fe82c46fc9f693b5b18045cddb6 (diff)
downloadlinux-25a21fbb934a0d989e1858f83c2ddf4cfb2ebe30.tar.xz
kbuild: Disable GCOV for *.mod.o
With GCOV_PROFILE_ALL, Clang injects __llvm_gcov_* functions to each object file, including the *.mod.o. As we filter out CC_FLAGS_CFI for *.mod.o, the compiler won't generate type hashes for the injected functions, and therefore indirectly calling them during module loading trips indirect call checking. Enabling CFI for *.mod.o isn't sufficient to fix this issue after commit 0c3e806ec0f9 ("x86/cfi: Add boot time hash randomization"), as *.mod.o aren't processed by objtool, which means any hashes emitted there won't be randomized. Therefore, in addition to disabling CFI for *.mod.o, also disable GCOV, as the object files don't otherwise contain any executable code. Fixes: cf68fffb66d6 ("add support for Clang CFI") Reported-by: Joe Fradley <joefradley@google.com> Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/Makefile.modfinal')
-rw-r--r--scripts/Makefile.modfinal2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
index 4703f652c009..fc19f67039bd 100644
--- a/scripts/Makefile.modfinal
+++ b/scripts/Makefile.modfinal
@@ -23,7 +23,7 @@ modname = $(notdir $(@:.mod.o=))
part-of-module = y
quiet_cmd_cc_o_c = CC [M] $@
- cmd_cc_o_c = $(CC) $(filter-out $(CC_FLAGS_CFI), $(c_flags)) -c -o $@ $<
+ cmd_cc_o_c = $(CC) $(filter-out $(CC_FLAGS_CFI) $(CFLAGS_GCOV), $(c_flags)) -c -o $@ $<
%.mod.o: %.mod.c FORCE
$(call if_changed_dep,cc_o_c)