Skip to content

[hls-fuzzer] Add reproducers for test cases#1012

Open
zero9178 wants to merge 1 commit into
users/zero9178/process-isolationfrom
users/zero9178/reproducer
Open

[hls-fuzzer] Add reproducers for test cases#1012
zero9178 wants to merge 1 commit into
users/zero9178/process-isolationfrom
users/zero9178/reproducer

Conversation

@zero9178

Copy link
Copy Markdown
Collaborator

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).

Depends on #1010

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`).
@zero9178
zero9178 requested a review from Jiahui17 July 16, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant