Re: [PATCH v2 06/11] kcov: x86: introduce CONFIG_KCOV_UNIQUE

From: Peter Zijlstra
Date: Mon Jun 30 2025 - 03:50:03 EST


On Fri, Jun 27, 2025 at 04:24:36PM +0200, Alexander Potapenko wrote:
> On Fri, Jun 27, 2025 at 10:11 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > On Thu, Jun 26, 2025 at 03:41:53PM +0200, Alexander Potapenko wrote:
> > > The new config switches coverage instrumentation to using
> > > __sanitizer_cov_trace_pc_guard(u32 *guard)
> > > instead of
> > > __sanitizer_cov_trace_pc(void)
> > >
> > > This relies on Clang's -fsanitize-coverage=trace-pc-guard flag [1].
> > >
> > > Each callback receives a unique 32-bit guard variable residing in the
> > > __sancov_guards section. Those guards can be used by kcov to deduplicate
> > > the coverage on the fly.
> >
> > This sounds like a *LOT* of data; how big is this for a typical kernel
> > build?
>
> I have a 1.6Gb sized vmlinux, which has a .text section of 176Mb.
> There are 1809419 calls to __sanitizer_cov_trace_pc_guard, and the
> __sancov_guards section has a size of 6Mb, which are only allocated at
> runtime.

OK, that's less than I feared. That's ~3.5% of .text, and should be
quite manageable.