Patch "kbuild: Disable GCOV for *.mod.o" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    kbuild: Disable GCOV for *.mod.o

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kbuild-disable-gcov-for-.mod.o.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ba169503f42e53f242cd01dde442e2d1a730f133
Author: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
Date:   Fri Jun 23 00:11:43 2023 +0000

    kbuild: Disable GCOV for *.mod.o
    
    [ Upstream commit 25a21fbb934a0d989e1858f83c2ddf4cfb2ebe30 ]
    
    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@xxxxxxxxxx>
    Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
    Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
    Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal
index ce9661d968a3d..47f047458264f 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)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux