Skip to content

Commit 7064dc7

Browse files
arndbgregkh
authored andcommitted
lkdtm: turn off kcov for lkdtm_rodata_do_nothing:
I ran into a link error on ARM64 for lkdtm_rodata_do_nothing: drivers/misc/built-in.o: In function `lkdtm_rodata_do_nothing': :(.rodata+0x68c8): relocation truncated to fit: R_AARCH64_CALL26 against symbol `__sanitizer_cov_trace_pc' defined in .text section in kernel/built-in.o I did not analyze this further, but my theory is that we would need a trampoline to call __sanitizer_cov_trace_pc(), but the linker (correctly) only adds trampolines for callers in executable sections. Disabling KCOV for this one file avoids the build failure with no other practical downsides I can think of. The problem can only happen on kernels that contain both kcov and lkdtm, so if we want to backport this, it should be in the earliest version that has both (v4.8). Fixes: 5c9a875 ("kernel: add kcov code coverage") Fixes: 9a49a52 ("lkdtm: add function for testing .rodata section") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Dmitry Vyukov <dvyukov@google.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e22aa9d commit 7064dc7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/misc/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ lkdtm-$(CONFIG_LKDTM) += lkdtm_perms.o
6161
lkdtm-$(CONFIG_LKDTM) += lkdtm_rodata_objcopy.o
6262
lkdtm-$(CONFIG_LKDTM) += lkdtm_usercopy.o
6363

64+
KCOV_INSTRUMENT_lkdtm_rodata.o := n
65+
6466
OBJCOPYFLAGS :=
6567
OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \
6668
--set-section-flags .text=alloc,readonly \

0 commit comments

Comments
 (0)