disable KCOV coverage for kexec code
PATCH 1/1 disable KCOV coverage for kexec code
Trying to have code coverage for the kexec code results in kexec-on-panic not working in a syzkaller setup.
Excluding the kexec code from code coverage makes it work again.
I cannot take credit for figuring this one out, this was all done by Claude driving a syzkaller setup, and examining the guest vcpu register dumps to figure out why kdump in the guest wasn't working. Now Claude has access to vmcores.
Signed-off-by Rik van Riel <[email protected]>
arch/x86/kernel/Makefile +5 -0
@@ -43,6 +43,11 @@ KCOV_INSTRUMENT_dumpstack_$(BITS).o := n KCOV_INSTRUMENT_unwind_orc.o := n KCOV_INSTRUMENT_unwind_frame.o := n KCOV_INSTRUMENT_unwind_guess.o := n +# machine_kexec accesses per-CPU data via GS during kexec; KCOV instrumentation +# there causes page faults → exception stack overflow → double fault, preventing +# kdump crash kernel from booting. +KCOV_INSTRUMENT_machine_kexec_64.o := n +KCOV_INSTRUMENT_machine_kexec.o := n CFLAGS_head32.o := -fno-stack-protector CFLAGS_head64.o := -fno-stack-protector
kernel/Makefile +4 -0
@@ -37,6 +37,10 @@ KCOV_INSTRUMENT_extable.o := n KCOV_INSTRUMENT_stacktrace.o := n # Don't self-instrument. KCOV_INSTRUMENT_kcov.o := n +# kexec_core.c contains __crash_kexec / machine_kexec paths that run with +# degraded CPU state; KCOV instrumentation there causes per-CPU GS faults. +KCOV_INSTRUMENT_kexec_core.o := n +KCOV_INSTRUMENT_kexec.o := n # If sanitizers detect any issues in kcov, it may lead to recursion # via printk, etc. KASAN_SANITIZE_kcov.o := n