Re: [PATCH 0/7] RFC: coverage deduplication for KCOV

From: Alexander Potapenko
Date: Thu Apr 17 2025 - 04:14:36 EST


> We've conducted an experiment running syz-testbed [3] on 10 syzkaller
> instances for 24 hours. Out of those 10 instances, 5 were enabling the
> kcov_deduplicate flag from [4], which makes use of the KCOV_UNIQUE_ENABLE
> ioctl, reserving 4096 words (262144 bits) for the bitmap and leaving 520192
> words for the trace collection.
>
> Below are the average stats from the runs.
>
> kcov_deduplicate=false:
> corpus: 52176
> coverage: 302658
> cover overflows: 225288
> comps overflows: 491
> exec total: 1417829
> max signal: 318894
>
> kcov_deduplicate=true:
> corpus: 52581
> coverage: 304344
> cover overflows: 986
> comps overflows: 626
> exec total: 1484841
> max signal: 322455
>
> [1] https://lore.kernel.org/linux-arm-kernel/20250114-kcov-v1-5-004294b931a2@xxxxxxxxxxx/T/
> [2] https://clang.llvm.org/docs/SanitizerCoverage.html
> [3] https://github.com/google/syzkaller/tree/master/tools/syz-testbed
> [4] https://github.com/ramosian-glider/linux/pull/7
Ouch, this should have been:
[4] https://github.com/ramosian-glider/syzkaller/tree/kcov_dedup-new

I will update the link in v2.
>
>
> Alexander Potapenko (7):
> kcov: apply clang-format to kcov code
> kcov: factor out struct kcov_state
> kcov: x86: introduce CONFIG_KCOV_ENABLE_GUARDS
> kcov: add `trace` and `trace_size` to `struct kcov_state`
> kcov: add ioctl(KCOV_UNIQUE_ENABLE)
> x86: objtool: add support for R_X86_64_REX_GOTPCRELX
> mm/kasan: define __asan_before_dynamic_init, __asan_after_dynamic_init
>
> Documentation/dev-tools/kcov.rst | 43 +++
> MAINTAINERS | 1 +
> arch/x86/include/asm/elf.h | 1 +
> arch/x86/kernel/module.c | 8 +
> arch/x86/kernel/vmlinux.lds.S | 1 +
> arch/x86/um/asm/elf.h | 1 +
> include/asm-generic/vmlinux.lds.h | 14 +-
> include/linux/kcov-state.h | 46 +++
> include/linux/kcov.h | 60 ++--
> include/linux/sched.h | 16 +-
> include/uapi/linux/kcov.h | 1 +
> kernel/kcov.c | 453 +++++++++++++++++++-----------
> lib/Kconfig.debug | 16 ++
> mm/kasan/generic.c | 18 ++
> mm/kasan/kasan.h | 2 +
> scripts/Makefile.kcov | 4 +
> scripts/module.lds.S | 23 ++
> tools/objtool/arch/x86/decode.c | 1 +
> tools/objtool/check.c | 1 +
> 19 files changed, 508 insertions(+), 202 deletions(-)
> create mode 100644 include/linux/kcov-state.h
>
> --
> 2.49.0.604.gff1f9ca942-goog
>


--
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg