Skip to content

Commit bf6fa2c

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64: entry: don't instrument entry code with KCOV
The code in entry-common.c runs at exception entry and return boundaries, where portions of the kernel environment aren't available. For example, RCU may not be watching, and lockdep state may be out-of-sync with the hardware. Due to this, it is not sound to instrument this code. We generally avoid instrumentation by marking the entry functions as `noinstr`, but currently this doesn't inhibit KCOV instrumentation. Prevent this by disabling KCOV for the entire compilation unit. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Marc Zyngier <maz@kernel.org> Cc: James Morse <james.morse@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20210607094624.34689-20-mark.rutland@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 6ecbc78 commit bf6fa2c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

arch/arm64/kernel/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE)
1414
CFLAGS_REMOVE_syscall.o = -fstack-protector -fstack-protector-strong
1515
CFLAGS_syscall.o += -fno-stack-protector
1616

17+
# It's not safe to invoke KCOV when portions of the kernel environment aren't
18+
# available or are out-of-sync with HW state. Since `noinstr` doesn't always
19+
# inhibit KCOV instrumentation, disable it for the entire compilation unit.
20+
KCOV_INSTRUMENT_entry.o := n
21+
1722
# Object file lists.
1823
obj-y := debug-monitors.o entry.o irq.o fpsimd.o \
1924
entry-common.o entry-fpsimd.o process.o ptrace.o \

0 commit comments

Comments
 (0)