[hls-fuzzer] Add reproducers for test cases#1012
Open
zero9178 wants to merge 1 commit into
Open
Conversation
When `hls-fuzzer` targets have bugs (e.g. type system generates invalid code or crashes) during a fuzzing campaign it is currently very hard to reproduce these due to the randomness of the generator. This PR therefore adds a new reproduction mechanism. Right before generating a program, a json file called `reprodcer.json` is dumped in the same directory that contains all data required to deterministically regenerate the *exact* same C file (assuming the fuzzer source code hasn't changed). By just rerunning `hls-fuzzer` with the `--reproduce` option, one can attach a debugger and figure out where e.g. a context was calculated incorrectly and other fixes that resulted in the given C file. Some other features: The reproducer automatically contains all target-related commandline options that affect generation. If the generated `test.c` file is not exactly the same as the one already present in the directory (if present), it will refuse to overwrite it and emit an error instead (guarding one from accidently overwriting a real buggy `test.c` e.g., because one accidently used a different version of `hls-fuzzer`).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
hls-fuzzertargets have bugs (e.g. type system generates invalid code or crashes) during a fuzzing campaign it is currently very hard to reproduce these due to the randomness of the generator.This PR therefore adds a new reproduction mechanism. Right before generating a program, a json file called
reprodcer.jsonis dumped in the same directory that contains all data required to deterministically regenerate the exact same C file (assuming the fuzzer source code hasn't changed). By just rerunninghls-fuzzerwith the--reproduceoption, one can attach a debugger and figure out where e.g. a context was calculated incorrectly and other fixes that resulted in the given C file.Some other features: The reproducer automatically contains all target-related commandline options that affect generation. If the generated
test.cfile is not exactly the same as the one already present in the directory (if present), it will refuse to overwrite it and emit an error instead (guarding one from accidently overwriting a real buggytest.ce.g., because one accidently used a different version ofhls-fuzzer).Depends on #1010