-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Regression on nightly since LLVM 8 upgrade: thread
sanitizer doesn't compile anymore
#53945
Comments
I have the same issue. |
libfuzzer-sys, which is used by cargo-fuzz also fails with the same error: |
It's broken since the upgrade to LLVM 8, see: rust-lang/rust#53945
It's broken since the upgrade to LLVM 8, see: rust-lang/rust#53945
I progressed a little bit on narrowing down the root cause of the issue. cd /tmp
git clone https://github.com/rust-fuzz/honggfuzz-rs.git
cd honggfuzz-rs/example/
RUSTFLAGS="-Z sanitizer=thread" ./test.sh If you use the |
(The regression is nightly-to-nightly and recent, the label must've been an accident) |
thread
sanitizer doesn't compile anymore
I am facing the same issue with address sanitizer on |
I'd like to work on this. |
Some initial findings: That error is emited by ld when(I think) a section links to both both unordered and order sections. Ordered sections are defined by the presence of the LLVM emits this flag in From what I can see, I'll need to investigate further to determine how this flag is getting left off. |
I've determine that passing I suspect that this issue is caused by an interaction between LLVM's In this case, LLVM would no longer add the SHF_LINK_ORDER flag to the ELF section, resulting in a linker error due to the missing flag. However, this is all still somewhat speculative. I'm going to try to come up with a minimal reproduction, which can hopefully be induced to fail/succeed by toggling the |
TL;DR: As as a temporary workaround, pass I've now determined that this is definitely an LLVM bug. I've created a minimal reproduction, which only uses Clang and other LLVM tools, here: https://github.com/Aaron1011/llvm_arg_elim The issue occurs due to the behavior of LLVM's As I described in my previous comment, this results in LLVM leaving off the I'll be filing a bug with LLVM once I'm given an account on their bugtracker. For now, you can work around this issue by passing |
Using the When using the default (BFD) linker, the 'has both ordered and unordered' error appears to be triggered by two separate bugs:
|
Fix suggested by Aaron Hill (@Aaron1011) here: rust-lang/rust#53945 (comment)
I've managed to come up with a full fix locally. I'll be submitting my changes to LLVM tomorrow, and will post the Phabricator link(s) here once I do so. The cause of the issue:
In both of these cases, the BFD linker will see proper, 'ordered' |
Here are all of the LLVM patches I've submitted (checked-off items have been merged): |
Nice! Might be worth pushing them to our llvm fork so we can pick them up more quickly? |
I think it might be best to wait until they're (hopefully) all accepted by LLVM. Getting them into the rust LLVM fork is going to require cherry-picking some additional commits, and it's possible that the LLVM team might want some changes before my patches are merged. |
rust-fuzz#141 + rust-lang/rust#53945 track issues with linkage which regressed when rust updated to llvm 8. This commit adds a work around for such issues for cargo-afl. This helps with the ergonomics of cargo-afl, particularly for those less familiar with the project and the above issues. These changes can be safely removed once patches are landed in llvm and rust updates to use the patched version.
#141 + rust-lang/rust#53945 track issues with linkage which regressed when rust updated to llvm 8. This commit adds a work around for such issues for cargo-afl. This helps with the ergonomics of cargo-afl, particularly for those less familiar with the project and the above issues. These changes can be safely removed once patches are landed in llvm and rust updates to use the patched version.
Recent Rust compilers have bugs that appear when fuzzing optimized binaries: rust-lang/rust#53945 This patch works around the issue by adding the "-C codegen-units=1 -C incremental=fuzz-incremental" arguments to `RUSTFLAGS`. Why this works I don't actually know. This workaround isn't mentioned in the linked issue, and afaik the "incremental" flag is simply changing the directory of the incremental cache, not turning it on or off. Signed-off-by: Brian Anderson <[email protected]>
This is a workaround for an LLVM 8 codegen issue. See rust-lang/rust#53945 for more information.
Recent Rust compilers have bugs that appear when fuzzing optimized binaries: rust-lang/rust#53945 This patch works around the issue by adding the "-C codegen-units=1 -C incremental=fuzz-incremental" arguments to `RUSTFLAGS`. Why this works I don't actually know. This workaround isn't mentioned in the linked issue, and afaik the "incremental" flag is simply changing the directory of the incremental cache, not turning it on or off. Signed-off-by: Brian Anderson <[email protected]>
Recent Rust compilers have bugs that appear when fuzzing optimized binaries: rust-lang/rust#53945 This patch works around the issue by adding the "-C codegen-units=1 -C incremental=fuzz-incremental" arguments to `RUSTFLAGS`. Why this works I don't actually know. This workaround isn't mentioned in the linked issue, and afaik the "incremental" flag is simply changing the directory of the incremental cache, not turning it on or off. Signed-off-by: Brian Anderson <[email protected]>
This is a workaround for an LLVM 8 codegen issue. See rust-lang/rust#53945 for more information.
This is a workaround for an LLVM 8 codegen issue. See rust-lang/rust#53945 for more information.
Recent Rust compilers have bugs that appear when fuzzing optimized binaries: rust-lang/rust#53945 This patch works around the issue by adding the "-C codegen-units=1 -C incremental=fuzz-incremental" arguments to `RUSTFLAGS`. Why this works I don't actually know. This workaround isn't mentioned in the linked issue, and afaik the "incremental" flag is simply changing the directory of the incremental cache, not turning it on or off. Signed-off-by: Brian Anderson <[email protected]>
Recent Rust compilers have bugs that appear when fuzzing optimized binaries: rust-lang/rust#53945 This patch works around the issue by adding the "-C codegen-units=1 -C incremental=fuzz-incremental" arguments to `RUSTFLAGS`. Why this works I don't actually know. This workaround isn't mentioned in the linked issue, and afaik the "incremental" flag is simply changing the directory of the incremental cache, not turning it on or off. Signed-off-by: Brian Anderson <[email protected]>
Recent Rust compilers have bugs that appear when fuzzing optimized binaries: rust-lang/rust#53945 This patch works around the issue by adding the "-C codegen-units=1 -C incremental=fuzz-incremental" arguments to `RUSTFLAGS`. Why this works I don't actually know. This workaround isn't mentioned in the linked issue, and afaik the "incremental" flag is simply changing the directory of the incremental cache, not turning it on or off. Signed-off-by: Brian Anderson <[email protected]>
This might be related to the linker versions. I.e. something that fails to build on travis builds successfully on my local machine with a super recent toolchain. |
That's some great detective work @Aaron1011! Did you ever hear anything more back about those patches? |
The fix of using `ld.gold` from rust-lang/rust#53945 (comment) sadly did not work for me, so instead we're going to only run ASAN on unit and integration tests. It's not great.
I would suggest raising the urgency on this, because the ld.gold workaround doesn't work here anymore. Relevant versions:
Both honggfuzz-rs and bolero (all backends: libfuser, honggfuzz, afl) now get linker errors.
|
@rustbot label A-sanitizers |
Hi, the fuzzer I maintain is failing to build on the latest nightlies:
The interesting part of the error log seems to be:
You can find the full log here:
https://travis-ci.org/rust-fuzz/honggfuzz-rs/jobs/424079778
I bisected on my computer the exact rust version that fails and it seems to be related to the LLVM 8 upgrade.
This version works well:
This version doesn't:
The text was updated successfully, but these errors were encountered: