-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
The fuzzing engine started with go test -fuzz stores inputs that expand code coverage in a subdirectory within the build cache. The subdirectory name is $GOCACHE/fuzz/$pkgpath/$target where $pkgpath is the import path of the package containing the fuzz target, and $target is the name of the fuzz target. The files are named after the SHA-256 sum of their contents, but the name doesn't matter, and we don't expect any other files in these directories.
Currently, the fuzzing cache is unlimited in both time and space. The user can clear the entire cache with go clean -fuzzcache, but that may reduce effectiveness of fuzzing until new inputs are discovered that provide equivalent coverage.
Before 1.18, we should implement at least a minimal cache eviction algorithm. It's probably fine to do the same thing we do for the build cache:
- When we fuzz a target with compatible cached files, set the modification time on those files to the current time if the previous time is more than 1 hour in the past.
- When
Cache.Trimis called (i.e., when any go command the uses the cache runs, at least 24 hours after the lastCache.Trim), delete files with modification times more than 5 days in the past.
5 days was a time limit that worked well for builds. We may want to choose a longer limit like 30 days for cached fuzz inputs.
cc @golang/Fuzzing
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status