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 <riel@surriel.com>
--
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index e9aeeeafad173..eeea5167f4ff5 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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
diff --git a/kernel/Makefile b/kernel/Makefile
index 6785982013dce..a1571d32cbb9d 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -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
© 2016 - 2026 Red Hat, Inc.