Add support for easily fuzzing cg_gcc with rustlantis#688
Merged
antoyo merged 1 commit intorust-lang:masterfrom May 28, 2025
Merged
Add support for easily fuzzing cg_gcc with rustlantis#688antoyo merged 1 commit intorust-lang:masterfrom
cg_gcc with rustlantis#688antoyo merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
Author
|
UGH, it looks like I anciently included some unrelated changes. |
cac3ac1 to
f62130e
Compare
Contributor
Author
|
Hopefully, should be good to review now. |
antoyo
reviewed
May 28, 2025
Contributor
antoyo
left a comment
There was a problem hiding this comment.
Thanks for your work!
Here's a first review:
Contributor
Author
|
Fixed the issues + added a few more detailed comments. Should be OK to review again now. |
antoyo
reviewed
May 28, 2025
Contributor
antoyo
left a comment
There was a problem hiding this comment.
One nitpick.
After that, I can merge it.
Thanks for the good work!
This command is going to be very useful.
Contributor
Author
|
Should be all ready for merge now. |
antoyo
approved these changes
May 28, 2025
Contributor
|
Thanks a lot for the amazing work! |
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.
This PR adds a new
ycommand:./y.sh fuzz.This command clones the rustlantis repo, and uses it to generate Rust programs to fuzz
cg_gccwith.It takes in 3 optional arguments: search space start(
--start), search space length(--count), and the parallelism(--jobs/-j).By default, the fuzzer will search the first 100 programs(this takes about a minute, and functions as a small test for more obscure semantics of rust, like NaN handling).
The script compiles programs with LLVM debug mode and GCC release mode, and then compares the result of their execution. If a compiler error occurs, or there is a runtime difference between the two backends, a message will be displayed, and the problematic source file will be copied over to either
target/fuzz/compiletime_errorortarget/fuzz/runtime_error.The fuzzer script respects
CG_RUSTFLAGS, which should allow us to test things like software floating point emulation, or 128 bit intiger emulation. We can also enable UB checks.Limitations
rustlantisdoes not support 32 bit systems without patches , so we can't fuzz on 32 bit platforms.Additonally, on platforms not supported by LLVM, we have nothing to compare to. We could compare against debug GCC runs, but that may miss things.
We might consider adding support for cross compilation / emulation, and compare scripts run on x86_64 with scripts run elsewhere.