[PATCH v4 6/6] sched/core: Pause KCOV in wake_up_new_task()
From: Karl Mehltretter
Date: Mon Oct 05 2026 - 15:00:10 EST
wake_up_new_task() is built without KCOV instrumentation, but CPU
selection and enqueue call helpers instrumented with KCOV. During a
KCOV-enabled fork, they can record scheduler, hrtimer and clockevent
coverage into the parent.
The paths depend on runqueue and CPU state, so coverage varies between
identical forks. Pause KCOV for the whole function, extending the
scheduler exclusion to new-task wakeups.
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@xxxxxxxxx>
---
kernel/sched/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f19221282278..888460c97952 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4969,6 +4969,9 @@ void wake_up_new_task(struct task_struct *p)
struct rq *rq;
int wake_flags = WF_FORK;
+ /* Callees instrumented with KCOV would leak coverage into current. */
+ guard(kcov_pause)();
+
raw_spin_lock_irqsave(&p->pi_lock, rf.flags);
WRITE_ONCE(p->__state, TASK_RUNNING);
/*
--
2.53.0