* [PATCH] disable KCOV coverage for kexec code
@ 2026-03-27 22:36 Rik van Riel
0 siblings, 0 replies; only message in thread
From: Rik van Riel @ 2026-03-27 22:36 UTC (permalink / raw)
To: linux-kernel
Cc: x86, kernel-team, Kai Huang, David Woodhouse, Coiby Xu,
Peter Zijlstra, Borislav Petkov
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-27 22:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 22:36 [PATCH] disable KCOV coverage for kexec code Rik van Riel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.