On Wed, Jun 03, 2026 at 07:43:32PM +0200, Yunseong Kim wrote: > The KCOV-Dataflow write path (kcov_df_write) only checks > t->kcov_df_enabled before writing to the shared ring buffer. Unlike > the standard KCOV check_kcov_mode() which rejects interrupt context, > kcov_df_write() has no such protection. This means instrumented code > running in hardirq, softirq, or NMI context that interrupts a task > mid-write can re-enter kcov_df_write(), causing: > > - Data corruption in the ring buffer (interleaved records) > - Out-of-order sequence counter increments > - Potential faults from nested pointer dereferences > > Add an in_task() check to reject calls from non-task context, matching > the safety model of the standard KCOV tracing path. > > Also suppress -Wmissing-prototypes in the eight_args_c test module > Makefile, as the exported test functions intentionally lack a shared > header. > > Signed-off-by: Yunseong Kim <[email protected]> > --- > kernel/kcov.c | 4 ++++ > tools/kcov-dataflow/eight_args_c/Makefile | 1 + > 2 files changed, 5 insertions(+) > > diff --git a/kernel/kcov.c b/kernel/kcov.c > index d3c9c0efe961..373b8034ca5c 100644 > --- a/kernel/kcov.c > +++ b/kernel/kcov.c > @@ -409,6 +409,10 @@ kcov_df_write(u64 type_marker, u64 pc, u64 meta, void > *ptr, > if (!t->kcov_df_enabled) > return; > > + /* Reject calls from hardirq/softirq/NMI to prevent reentrant > corruption. */ > + if (!in_task()) > + return; > + > area = (u64 *)t->kcov_df_area; > if (!area) > return; > diff --git a/tools/kcov-dataflow/eight_args_c/Makefile > b/tools/kcov-dataflow/eight_args_c/Makefile > index de35bb541f07..038775b49435 100644 > --- a/tools/kcov-dataflow/eight_args_c/Makefile > +++ b/tools/kcov-dataflow/eight_args_c/Makefile > @@ -1,2 +1,3 @@ > obj-m := eight_args_mod.o > KCOV_DATAFLOW_eight_args_mod.o := y > +ccflags-y += -Wno-missing-prototypes
This is a weird commit and probably should not exist. You introduce kcov_df_write() a few patches ago, why doesn't it add these few lines there? Similarly, you introduce this tools thing a few patches ago, fix the Makefile there?

