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

Address Sanitizer is Failing to Compile with libfuzzer With Optimization and with Doc Tests in Any Mode #55960

Closed
brunoczim opened this Issue Nov 14, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@brunoczim
Copy link

brunoczim commented Nov 14, 2018

Using rustc 1.32.0-nightly (9fefb6766 2018-11-13)

NOTE: target is x86_64-unknown-linux-gnu. Adding a flag with a target does not change the outcome.

  1. Clone this repository: https://github.com/brunoczim/lockfree

  2. Run RUSTFLAGS='-Z sanitizer=address' ASAN_OPTIONS=detect_odr_violation=0 cargo test --doc
    Output I get is (I had to put it in a gist because of size): https://gist.github.com/brunoczim/d4b70359cf3dc0124ea06d47bc4d8f24

  3. (Optional) Install cargo-fuzz

  4. (Optional) Run cargo fuzz run queue --release --sanitizer=address (you may replace queue with any target). The output I get is:

       Fresh cc v1.0.25
   Compiling owned-alloc v0.2.0
   Compiling arbitrary v0.1.1
   Compiling fuzzsuite v0.1.0 (/home/bruno/prog/rust/lockfree/fuzz/fuzzsuite)
     Running `rustc --crate-name owned_alloc /home/bruno/.cargo/registry/src/github.com-1ecc6299db9ec823/owned-alloc-0.2.0/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=3d2d6d20c93b12fa -C extra-filename=-3d2d6d20c93b12fa --out-dir /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/release/deps --cap-lints allow --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-trace-divs -Cllvm-args=-sanitizer-coverage-trace-geps -Cllvm-args=-sanitizer-coverage-prune-blocks=0 -Zsanitizer=address -Cpanic=abort`
     Running `rustc --crate-name arbitrary /home/bruno/.cargo/registry/src/github.com-1ecc6299db9ec823/arbitrary-0.1.1/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=a401a12a02dfb858 -C extra-filename=-a401a12a02dfb858 --out-dir /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/release/deps --cap-lints allow --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-trace-divs -Cllvm-args=-sanitizer-coverage-trace-geps -Cllvm-args=-sanitizer-coverage-prune-blocks=0 -Zsanitizer=address -Cpanic=abort`
     Running `rustc --crate-name fuzzsuite fuzzsuite/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=85c0359334d2ae87 -C extra-filename=-85c0359334d2ae87 --out-dir /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/release/deps --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-trace-divs -Cllvm-args=-sanitizer-coverage-trace-geps -Cllvm-args=-sanitizer-coverage-prune-blocks=0 -Zsanitizer=address -Cpanic=abort`
   Compiling lockfree v0.5.0 (/home/bruno/prog/rust/lockfree)
     Running `rustc --crate-name lockfree /home/bruno/prog/rust/lockfree/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=df855701c2b515e9 -C extra-filename=-df855701c2b515e9 --out-dir /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/release/deps --extern owned_alloc=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/libowned_alloc-3d2d6d20c93b12fa.rlib --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-trace-divs -Cllvm-args=-sanitizer-coverage-trace-geps -Cllvm-args=-sanitizer-coverage-prune-blocks=0 -Zsanitizer=address -Cpanic=abort`
   Compiling libfuzzer-sys v0.1.0 (https://github.com/rust-fuzz/libfuzzer-sys.git#4a413199)
     Running `rustc --crate-name libfuzzer_sys /home/bruno/.cargo/git/checkouts/libfuzzer-sys-e07fde05820d7bc6/4a41319/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=a6b4368c83d446b4 -C extra-filename=-a6b4368c83d446b4 --out-dir /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/release/deps --extern arbitrary=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/libarbitrary-a401a12a02dfb858.rlib --cap-lints allow --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-trace-divs -Cllvm-args=-sanitizer-coverage-trace-geps -Cllvm-args=-sanitizer-coverage-prune-blocks=0 -Zsanitizer=address -Cpanic=abort -L native=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/build/libfuzzer-sys-be0763f814021847/out -l static=fuzzer -l stdc++`
   Compiling lockfree-fuzz v0.0.1 (/home/bruno/prog/rust/lockfree/fuzz)
     Running `rustc --crate-name queue fuzz_targets/queue.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=72a544769c00fc4c -C extra-filename=-72a544769c00fc4c --out-dir /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/release/deps --extern fuzzsuite=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/libfuzzsuite-85c0359334d2ae87.rlib --extern libfuzzer_sys=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblibfuzzer_sys-a6b4368c83d446b4.rlib --extern lockfree=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblockfree-df855701c2b515e9.rlib --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-trace-divs -Cllvm-args=-sanitizer-coverage-trace-geps -Cllvm-args=-sanitizer-coverage-prune-blocks=0 -Zsanitizer=address -Cpanic=abort -L native=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/build/libfuzzer-sys-be0763f814021847/out`
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.0.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.1.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.10.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.11.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.12.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.13.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.14.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.15.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.2.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.3.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.4.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.5.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.6.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.7.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.8.rcgu.o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.9.rcgu.o" "-o" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.2pq455ha766vngqd.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps" "-L" "/home/bruno/prog/rust/lockfree/fuzz/target/release/deps" "-L" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/build/libfuzzer-sys-be0763f814021847/out" "-L" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "/tmp/rustcmkgREQ/librustc_asan-94e819b0894ac5f0.rlib" "-Wl,--no-whole-archive" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblockfree-df855701c2b515e9.rlib" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/libowned_alloc-3d2d6d20c93b12fa.rlib" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/libfuzzsuite-85c0359334d2ae87.rlib" "/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblibfuzzer_sys-a6b4368c83d446b4.rlib" "-Wl,--start-group" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-ca89670c0aa09fda.rlib" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort-4f5cf4f4eb152e3a.rlib" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-4098f7d1d31de6c4.rlib" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-988c63ff0ee10ef7.rlib" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-b017eaf876959078.rlib" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0c2a05e1072c9bc2.rlib" "-Wl,--end-group" "/home/bruno/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-6231ec20e5b0729f.rlib" "-Wl,-Bdynamic" "-lstdc++" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/bin/ld: __sancov_guards has both ordered [`__sancov_guards' in /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.11.rcgu.o] and unordered [`__sancov_guards' in /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/queue-72a544769c00fc4c.queue.4yy8dot1-cgu.11.rcgu.o] sections
          /usr/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: Could not compile `lockfree-fuzz`.

Caused by:
  process didn't exit successfully: `rustc --crate-name queue fuzz_targets/queue.rs --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=72a544769c00fc4c -C extra-filename=-72a544769c00fc4c --out-dir /home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/bruno/prog/rust/lockfree/fuzz/target/release/deps --extern fuzzsuite=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/libfuzzsuite-85c0359334d2ae87.rlib --extern libfuzzer_sys=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblibfuzzer_sys-a6b4368c83d446b4.rlib --extern lockfree=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblockfree-df855701c2b515e9.rlib --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-pc-guard -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-trace-divs -Cllvm-args=-sanitizer-coverage-trace-geps -Cllvm-args=-sanitizer-coverage-prune-blocks=0 -Zsanitizer=address -Cpanic=abort -L native=/home/bruno/prog/rust/lockfree/fuzz/target/x86_64-unknown-linux-gnu/release/build/libfuzzer-sys-be0763f814021847/out` (exit code: 1)
error: could not build fuzz script: "cargo" "build" "--manifest-path" "/home/bruno/prog/rust/lockfree/fuzz/Cargo.toml" "--verbose" "--bin" "queue" "--target" "x86_64-unknown-linux-gnu" "--release"
@Aaron1011

This comment has been minimized.

Copy link
Contributor

Aaron1011 commented Nov 14, 2018

Duplicate of #53945

@Aaron1011 Aaron1011 marked this as a duplicate of #53945 Nov 14, 2018

@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Nov 16, 2018

Closing.

@nagisa nagisa closed this Nov 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment