-
Notifications
You must be signed in to change notification settings - Fork 77
Add support for easily fuzzing cg_gcc
with rustlantis
#688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
UGH, it looks like I anciently included some unrelated changes. |
cac3ac1
to
f62130e
Compare
Hopefully, should be good to review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work!
Here's a first review:
Fixed the issues + added a few more detailed comments. Should be OK to review again now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nitpick.
After that, I can merge it.
Thanks for the good work!
This command is going to be very useful.
Should be all ready for merge now. |
Thanks a lot for the amazing work! |
This PR adds a new
y
command:./y.sh fuzz
.This command clones the rustlantis repo, and uses it to generate Rust programs to fuzz
cg_gcc
with.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_error
ortarget/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
rustlantis
does 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.