-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Background
Go modules are currently an opt-in feature of the go command. The GO111MODULE env var controls when module-mode is enabled for the go command.
go-fuzz does not currently support module-mode, but that might change soon.
Suggested change
It would be helpful to explicitly set GO111MODULE=off within oss-fuzz for projects/golang.
The oss-fuzz change could look something like this.
The history is a bit confusing, but in short, it is likely better for oss-fuzz to be explicitly in control over whether or not module-mode is enabled by setting GO111MODULE explicitly, rather than being surprised on a random day by one or more upstream changes that are likely to happen.
Additional details
This might be more detail than is interesting, but a bit more about the history here, as well as more on the rationale for this change:
- The go command's default value for
GO111MODULEdid change twice during Go 1.13 dev cycle — first the default was changed fromautotoon, and then later that was reversed. The first time it changed to default toon, that caused breakage for oss-fuzz (for example in Golang internal library fuzzers #2188 (comment)). - When that breakage happened for oss-fuzz during the Go 1.13 dev cycle, there was a temporary workaround introduced in go-fuzz of setting
GO111MODULE=offwithin go-fuzz itself. - Although the details are still being worked out (e.g., go-fuzz-build doesn't work with go modules (go 1.11.2) dvyukov/go-fuzz#195), most likely as part of adding support for fuzzing modules, go-fuzz will be removing that temporary workaround of always setting
GO111MODULE=off(and most likely go-fuzz will start respecting the user's setting forGO111MODULEat least to some degree). - The go command's default value for
GO111MODULEis planned to be changed again to default toonduring the Go 1.14 development cycle (which is a second try at the same change that broke oss-fuzz in Golang internal library fuzzers #2188 (comment)). - If both of those things happen without any change on the oss-fuzz side, then the fuzzing of projects/golang on oss-fuzz would likely break. Rather than that happening on a random day, it is better to have more explicit control within oss-fuzz itself by disabling GO111MODULE explicitly as suggested in this issue.
- Right now, none of the packages at dvyukov/go-fuzz-corpus/... are modules, which means no one is relying on module mode being enabled (and in fact, if someone was relying on module-mode being enabled, it wouldn't work for them currently because go-fuzz does not yet support modules).
Alternatives
Two alternatives to consider:
- Rather than setting
GO111MODULE=offin the build.sh, set it in the docker file. That could be a reasonable choice as well. My guess is it makes more sense in build.sh, but the right answer here is probably dependent on the oss-fuzz philosophy. - Rather than setting
GO111MODULE=off, setGO111MODULE=auto. That could be a reasonable choice currently, but I think from oss-fuzz perspective, it is probably a more conservative change to doGO111MODULE=off, including because go-fuzz currently setsGO111MODULE=off(and notGO111MODULE=auto), and also the meaning ofautochanged during the Go 1.13 dev cycle and some small-ish chance the meaning ofautomight change again on a random day during the Go 1.14 dev cycle, and hence slightly more future proof to not useauto.