testing: custom mutator support for fuzzing #48815
Labels
FeatureRequest
fuzz
Issues related to native fuzzing support
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
As the official fuzzer implementation provided by golang, the native fuzzer should be well suited for various usage scenarios. However, currently native fuzzers only support general mutation algorithms for built-in types. Therefore, in many cases, the native fuzzer cannot efficiently generate test inputs. For example, when testing a DSL parser, the mutator will generate a large amount of output that cannot pass the syntax or semantic check. A possible solution is to provide support for custom mutators, so that users can implement custom mutators for various fuzz targets and reuse other parts of the native fuzzer.
I tried on the existing code and designed the following interface:
The object that implements the above interface can be passed as an argument to the
testing.F.Fuzz
method, and it will call theMutate
method to use the custom mutation algorithm. TheMarshal
andUnmarshal
methods ensure that it can be imported/exported to a corpus file.I think supporting custom mutator will bring the following benefits:
In addition, custom mutator will also bring some side effects, such as the custom mutator code will be instrumented, which may affect performance and the accuracy of coverage statistics.
/cc @jayconrod
The text was updated successfully, but these errors were encountered: