gvisor/runsc
Dean Deng cb573c8e0b Expose basic coverage information to userspace through kcov interface.
In Linux, a kernel configuration is set that compiles the kernel with a
custom function that is called at the beginning of every basic block, which
updates the memory-mapped coverage information. The Go coverage tool does not
allow us to inject arbitrary instructions into basic blocks, but it does
provide data that we can convert to a kcov-like format and transfer them to
userspace through a memory mapping.

Note that this is not a strict implementation of kcov, which is especially
tricky to do because we do not have the same coverage tools available in Go
that that are available for the actual Linux kernel. In Linux, a kernel
configuration is set that compiles the kernel with a custom function that is
called at the beginning of every basic block to write program counters to the
kcov memory mapping. In Go, however, coverage tools only give us a count of
basic blocks as they are executed. Every time we return to userspace, we
collect the coverage information and write out PCs for each block that was
executed, providing userspace with the illusion that the kcov data is always
up to date. For convenience, we also generate a unique synthetic PC for each
block instead of using actual PCs. Finally, we do not provide thread-specific
coverage data (each kcov instance only contains PCs executed by the thread
owning it); instead, we will supply data for any file specified by --
instrumentation_filter.

Also, fix issue in nogo that was causing pkg/coverage:coverage_nogo
compilation to fail.

PiperOrigin-RevId: 328426526
2020-08-25 16:28:45 -07:00
..
boot [vfs] Allow mountpoint to be an existing non-directory. 2020-08-21 20:06:01 -07:00
cgroup Merge pull request #3102 from stripe:andrew/cgroup-eintr 2020-07-28 13:16:30 -07:00
cmd Move boot.Config to its own package 2020-08-19 18:37:42 -07:00
config Expose basic coverage information to userspace through kcov interface. 2020-08-25 16:28:45 -07:00
console Standardize on tools directory. 2020-01-27 12:21:00 -08:00
container Move boot.Config to its own package 2020-08-19 18:37:42 -07:00
flag Add flag package to limit visibility. 2020-02-10 13:57:01 -08:00
fsgofer Move boot.Config to its own package 2020-08-19 18:37:42 -07:00
sandbox Move boot.Config to its own package 2020-08-19 18:37:42 -07:00
specutils Merge pull request #2672 from amscanne:shim-integrated 2020-07-13 16:10:58 -07:00
BUILD Include shim in individual released binaries. 2020-08-25 12:24:32 -07:00
main.go Move boot.Config to its own package 2020-08-19 18:37:42 -07:00
version.go Fix `runsc --version` and add a test. 2019-09-10 15:41:47 -07:00
version_test.sh Standardize on tools directory. 2020-01-27 12:21:00 -08:00