linux-stable/init
Sami Tolvanen a566122a8f kbuild: Fix CFI failures with GCOV
[ Upstream commit ddf56288ee ]

With GCOV_PROFILE_ALL, Clang injects __llvm_gcov_* functions to
each object file, and the functions are indirectly called during
boot. However, when code is injected to object files that are not
part of vmlinux.o, it's also not processed by objtool, which breaks
CFI hash randomization as the hashes in these files won't be
included in the .cfi_sites section and thus won't be randomized.

Similarly to commit 42633ed852 ("kbuild: Fix CFI hash
randomization with KASAN"), disable GCOV for .vmlinux.export.o and
init/version-timestamp.o to avoid emitting unnecessary functions to
object files that don't otherwise have executable code.

Fixes: 0c3e806ec0 ("x86/cfi: Add boot time hash randomization")
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-11 19:39:50 +02:00
..
.gitignore kbuild: build init/built-in.a just once 2022-09-29 04:40:15 +09:00
Kconfig gcc: disable '-Warray-bounds' for gcc-13 too 2023-04-23 09:56:20 -07:00
Makefile kbuild: Fix CFI failures with GCOV 2023-07-11 19:39:50 +02:00
build-version kbuild: build init/built-in.a just once 2022-09-29 04:40:15 +09:00
calibrate.c
do_mounts.c init: move from strlcpy with unused retval to strscpy 2022-09-11 21:55:10 -07:00
do_mounts.h
do_mounts_initrd.c freezer,umh: Clean up freezer/initrd interaction 2022-09-07 21:53:48 +02:00
do_mounts_rd.c
init_task.c
initramfs.c init/initramfs: Fix argument forwarding to panic() in panic_show_mem() 2023-04-16 17:37:01 +09:00
main.c bootconfig: Change message if no bootconfig with CONFIG_BOOT_CONFIG_FORCE=y 2023-03-22 22:21:43 +09:00
noinitramfs.c
version-timestamp.c init/version-timestamp.c: remove unneeded #include <linux/version.h> 2023-01-09 07:34:38 +09:00
version.c init/version.c: remove #include <generated/utsrelease.h> 2022-12-10 10:33:20 +09:00