summaryrefslogtreecommitdiffhomepage
path: root/runsc/config
diff options
context:
space:
mode:
authorDean Deng <deandeng@google.com>2020-08-25 16:26:53 -0700
committerAndrei Vagin <avagin@gmail.com>2020-09-09 17:53:10 -0700
commit5683a8568adc9c13c1cf9d360dae105dc60b145d (patch)
treed0d1a4f4febe8ec3ca2c707a2a9a25d95cbc13b3 /runsc/config
parentc8125fe386f7b835e04a0ea40a2b501ef61598e5 (diff)
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
Diffstat (limited to 'runsc/config')
-rw-r--r--runsc/config/config.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/runsc/config/config.go b/runsc/config/config.go
index ca85cef51..8cf0378d5 100644
--- a/runsc/config/config.go
+++ b/runsc/config/config.go
@@ -300,10 +300,10 @@ type Config struct {
// E.g. 0.2 CPU quota will result in 1, and 1.9 in 2.
CPUNumFromQuota bool
- // Enables VFS2 (not plumbled through yet).
+ // Enables VFS2 (not plumbed through yet).
VFS2 bool
- // Enables FUSE usage (not plumbled through yet).
+ // Enables FUSE usage (not plumbed through yet).
FUSE bool
// TestOnlyAllowRunAsCurrentUserWithoutChroot should only be used in
@@ -353,6 +353,8 @@ func (c *Config) ToFlags() []string {
"--tx-checksum-offload=" + strconv.FormatBool(c.TXChecksumOffload),
"--overlayfs-stale-read=" + strconv.FormatBool(c.OverlayfsStaleRead),
"--qdisc=" + c.QDisc.String(),
+ "--vfs2=" + strconv.FormatBool(c.VFS2),
+ "--fuse=" + strconv.FormatBool(c.FUSE),
}
if c.CPUNumFromQuota {
f = append(f, "--cpu-num-from-quota")