Re: [PATCH resend] kcov: allow simultaneous KCOV_ENABLE/KCOV_REMOTE_ENABLE
From: Andrew Morton
Date: Fri May 08 2026 - 21:24:07 EST
On Tue, 05 May 2026 11:00:46 +0200 Jann Horn <jannh@xxxxxxxxxx> wrote:
> Allow the same userspace thread to simultaneously collect normal coverage
> in syscall context (KCOV_ENABLE) and remote coverage of asynchronous work
> created by the thread (KCOV_REMOTE_ENABLE).
> With this, remote KCOV coverage becomes useful for generic fuzzing and not
> just fuzzing of specific data injection interfaces.
>
> This requires that the task_struct::kcov_* fields are separated into ones
> that are used by the task that generates coverage, and ones that are used
> by the task that requested remote coverage. To split this up:
>
> - Split task_struct::kcov into kcov and kcov_remote. kcov_task_exit() now
> has to clean up both separately.
> - Only use task_struct::kcov_mode on the task that generates coverage.
> - Only reset task_struct::kcov_handle on the task that requested remote
> coverage.
>
> After this change, fields used by the task that generates coverage are:
>
> - kcov_mode
> - kcov_size
> - kcov_area
> - kcov
> - kcov_sequence
> - kcov_softirq
>
> Fields used by the task that requested remote coverage are:
>
> - kcov_remote
> - kcov_handle
Thanks, I queued this for testing while we await reviewer input.
checkpatch asked:
WARNING: Using vsprintf specifier '%px' potentially exposes the kernel memory layout, if you don't really need the address please consider using '%p'.
#141: FILE: kernel/kcov.c:463:
+ kcov_debug("t = %px, kcov->t = %px\n", t, kcov->t);
and Sashiko found a femtobug:
https://sashiko.dev/#/patchset/20260505-kcov-simultaneous-remote-v1-1-a670ba7cefd2@xxxxxxxxxx