Skip to content
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

Disable dead stripping #193

Merged
merged 1 commit into from
Nov 21, 2019
Merged

Disable dead stripping #193

merged 1 commit into from
Nov 21, 2019

Conversation

alpire
Copy link
Contributor

@alpire alpire commented Nov 21, 2019

With dead stripping, some optimized targets would fail to start fuzzing with the following error:

ERROR: The size of coverage PC tables does not match the
number of instrumented PCs. This might be a compiler bug,
please contact the libFuzzer developers.
Also check https://bugs.llvm.org/show_bug.cgi?id=34636
for possible workarounds (tl;dr: don't use the old GNU ld)

If you'd like to reproduce the issue, clone https://github.com/cloudflare/quiche and run cargo fuzz run packet_recv_client --release from the fuzz directory. You should see the above error.

This PR disables dead stripping, which removes the above error. Alternatively, one could use ld.gold by adding -Clink-arg=-fuse-ld=gold to RUSTFLAGS. This would also fix the error. However, I did not want to assume that ld.gold was present on users' systems. Others have also successfully switched to disabling dead stripping, like OSS-Fuzz, so it seemed like a better solution.

Environment
cargo-fuzz 0.5.4
cargo 1.41.0-nightly (8280633db 2019-11-11)
rustc 1.41.0-nightly (3e525e3f6 2019-11-18)
Debian bullseye container running on Mac OS 10.15.1 and Docker Desktop 2.1.0.5

Without it, some optimized targets would fail to launch with the
following error:

ERROR: The size of coverage PC tables does not match the
number of instrumented PCs. This might be a compiler bug,
please contact the libFuzzer developers.
Also check https://bugs.llvm.org/show_bug.cgi?id=34636
for possible workarounds (tl;dr: don't use the old GNU ld)

Related to:
- google/oss-fuzz#1042
- llvm.org/pr34636
@alpire
Copy link
Contributor Author

alpire commented Nov 21, 2019

The build is currently broken due to rust-lang/rust#66140. The same failure is on master as well.

I assume that the pipeline will be fixed once rust-lang/rust#65241 makes it to the nightly build. Once that's the case, we should try re-running the pipeline on this PR to make sure it's passing.

@nagisa
Copy link
Member

nagisa commented Nov 21, 2019

We can manually merge this, this seems harmless enough and fixes an important issue.

@nagisa nagisa merged commit 86b4889 into rust-fuzz:master Nov 21, 2019
ghedo pushed a commit to cloudflare/quiche that referenced this pull request Nov 25, 2019
Optimizations significantly inscreases fuzzing speed. This requires
cargo-fuzz 0.5.5+. See rust-fuzz/cargo-fuzz#193
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.

2 participants