-
Notifications
You must be signed in to change notification settings - Fork 114
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
fuzz_mutator
seems to not work with stripping dead code by default
#396
Comments
I can't reproduce this. What target are you compiling for? What linker are you using? |
rustc: 1.84.0-aarch64-apple-darwin I'm not sure how to check what rustc is invoking for linking |
I was trying to repro on Linux. Easy repro on a Mac laptop. I think the problem is that the custom mutator system relies on exporting symbols from executables, which is the (stalled) flag
This problem only happens on Apple targets because libfuzzer uses a different mechanism to load these functions on Apple targets. On linux/bsd, libfuzzer uses weak symbols and says this is the reason it doesn't use them on Apple:
I'm not sure I agree that some If you enable the weak symbol strategy on Apple, here's how you'd build a simple mutator fuzzer:
Inglorious, but I can confirm it works. |
Using the package from crates prior to #394:
If I install from git
cargo install --git https://github.com/rust-fuzz/cargo-fuzz
, it not longer panics nearly instantly (finds an input that is prefixed with "boom"). I suspect this is becausefuzz_mutator
is stripped due to #394. That said, I did notice stripping dead code fixed errorsllvm-cov
produced when I was trying to generating coverage reports.More info:
If I compile the example in a standalone project without cargo-fuzz, I can reproduce the behavior more clearly.
Next, add a
panic!();
tofuzz_mutator!
and run ./target/debug/example_mutator
. I get a crash at the inserted panic.If I remove
-C link-dead-code
, the panic isn't reached.The text was updated successfully, but these errors were encountered: