-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
In gVisor, we implemented /sys/kernel/debug/kcov, which provides the user-space interface for kernel code coverage data. In this context, the "kernel" is the gVisor Sentry. For example, a guest process can execute a few system calls and then retrieve the coverage data for the Sentry code that have been executed by those syscalls. The main consumer of this feature is syzkaller (fuzzer).
Originally, /sys/kernel/debug/kcov was implemented based on the old coverage golang API: google/gvisor@cb573c8
We found that the new code coverage interface was introduced just recently when rules_go switched on it: bazel-contrib/rules_go#4397.
When I start working on adopting the new API, I found that there is no way to parser coverage data within an application. Coverage data can be saved in a file and then processed with the go tool cover tool. For gVisor, using a separate tool to process a coverage data isn't an option for both performance and security reasons. The Sentry is running in a completely isolated environments with strict seccomp rules.
As a temporary workaround, we are going to use internal packages: avagin/gvisor@1761620. From a long-term perspective, we want to have an upstream, public API to parse the coverage data.