On Tue, Feb 28, 2023 at 10:37 AM Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote: > > On Mon, 27 Feb 2023 at 18:17, <andrey.konovalov@xxxxxxxxx> wrote: > > > > From: Andrey Konovalov <andreyknvl@xxxxxxxxxx> > > > > Improve KCOV documentation: > > > > - Use KCOV instead of kcov, as the former is more widely-used. > > > > - Mention Clang in compiler requirements. > > > > - Use ``annotations`` for inline code. > > > > - Rework remote coverage collection documentation for better clarity. > > > > - Various smaller changes. > > > > Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> > > --- > > Documentation/dev-tools/kcov.rst | 169 +++++++++++++++++++------------ > > 1 file changed, 102 insertions(+), 67 deletions(-) > > > > diff --git a/Documentation/dev-tools/kcov.rst b/Documentation/dev-tools/kcov.rst > > index d83c9ab49427..a113a03a475f 100644 > > --- a/Documentation/dev-tools/kcov.rst > > +++ b/Documentation/dev-tools/kcov.rst > > @@ -1,42 +1,50 @@ > > -kcov: code coverage for fuzzing > > +KCOV: code coverage for fuzzing > > =============================== > > > > -kcov exposes kernel code coverage information in a form suitable for coverage- > > -guided fuzzing (randomized testing). Coverage data of a running kernel is > > -exported via the "kcov" debugfs file. Coverage collection is enabled on a task > > -basis, and thus it can capture precise coverage of a single system call. > > +KCOV collects and exposes kernel code coverage information in a form suitable > > +for coverage-guided fuzzing. Coverage data of a running kernel is exported via > > +the ``kcov`` debugfs file. Coverage collection is enabled on a task basis, and > > +thus KCOV can capture precise coverage of a single system call. > > > > -Note that kcov does not aim to collect as much coverage as possible. It aims > > -to collect more or less stable coverage that is function of syscall inputs. > > -To achieve this goal it does not collect coverage in soft/hard interrupts > > -and instrumentation of some inherently non-deterministic parts of kernel is > > -disabled (e.g. scheduler, locking). > > +Note that KCOV does not aim to collect as much coverage as possible. It aims > > +to collect more or less stable coverage that is a function of syscall inputs. > > +To achieve this goal, it does not collect coverage in soft/hard interrupts > > +(unless remove coverage collection is enabled, see below) and from some > > +inherently non-deterministic parts of the kernel (e.g. scheduler, locking). > > > > -kcov is also able to collect comparison operands from the instrumented code > > -(this feature currently requires that the kernel is compiled with clang). > > +Besides collecting code coverage, KCOV can also collect comparison operands. > > +See the "Comparison operands collection" section for details. > > + > > +Besides collecting coverage data from syscall handlers, KCOV can also collect > > +coverage for annotated parts of the kernel executing in background kernel > > +tasks or soft interrupts. See the "Remote coverage collection" section for > > +details. > > > > Prerequisites > > ------------- > > > > -Configure the kernel with:: > > +KCOV relies on compiler instrumentation and requires GCC 6.1.0 or later > > +or any Clang version supported by the kernel. > > > > - CONFIG_KCOV=y > > +Collecting comparison operands is only supported with Clang. > > Are you sure? > I see -fsanitize-coverage=trace-cmp in gcc sources and man page. Right, supported too starting with version 8. Will fix in v2. > Otherwise looks good to me. I'll add your Reviewed-by to v2 then. Thank you!