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

infra: show RUSTFLAGS as well #5867

Merged
merged 1 commit into from
Jun 2, 2021
Merged

Conversation

evverx
Copy link
Contributor

@evverx evverx commented Jun 2, 2021

It should make it easier to see where all the rustc flags
come from. RUSTFLAGS along with cargo fuzz build --verbose should
help to track down weird issues like #5865 (comment)

It's a follow-up to ecf3d38

It should make it easier to see where all the rustc flags
come from. RUSTFLAGS along with `cargo fuzz build --verbose` should
help to track down weird issues like google#5865 (comment)

It's a follow-up to ecf3d38
@evverx
Copy link
Contributor Author

evverx commented Jun 2, 2021

Trying to figure out where I lost my backtraces, I noticed that in 4f7cf1b CUSTOM_LIBFUZZER_PATH and CUSTOM_LIBFUZZER_STD_CXX were introduced and it seems to be the only difference between the base-builder image and my local VM. I'm not sure I understand what those environment variables do. Could it be that they have something to do with #5865 (comment)?

Without those variables it's failing to compile in the base builder image:

^[[0m^[[0m^[[1m^[[32m   Compiling^[[0m toml-fuzz v0.0.0 (/src/toml-rs/fuzz)^M
^[[0m^[[0m^[[1m^[[32m     Running^[[0m `rustc --crate-name fuzz_from_to_string --edition=2018 fuzz_targets/fuzz_from_to_string.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=b333460274e8cb82 -C extra-filename=-b333460274e8cb82 --out-dir /src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/src/toml-rs/fuzz/target/release/deps --extern libfuzzer_sys=/src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblibfuzzer_sys-03a713efd07706bd.rlib --extern toml=/src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/deps/libtoml-fcc8d3cc00d03c7f.rlib --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Clink-dead-code -Zsanitizer=address -Cllvm-args=-sanitizer-coverage-stack-depth -C codegen-units=1 --cfg fuzzing -Zsanitizer=address -Cdebuginfo=1 -Cforce-frame-pointers -L native=/src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/build/libfuzzer-sys-8fe07a06d6becf58/out`^M
^[[0m^[[1m^[[38;5;9merror^[[0m^[[0m^[[1m: linking with `cc` failed: exit status: 1^[[0m^M
"OUT" 885L, 235857B                                                                                                                                                                       1,1           Top
          /rust/registry/src/github.com-1ecc6299db9ec823/libfuzzer-sys-0.4.2/libfuzzer/FuzzerFork.cpp:85: undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()'
          /rust/registry/src/github.com-1ecc6299db9ec823/libfuzzer-sys-0.4.2/libfuzzer/FuzzerFork.cpp:85: undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()'
          /rust/registry/src/github.com-1ecc6299db9ec823/libfuzzer-sys-0.4.2/libfuzzer/FuzzerFork.cpp:85: undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()'
          /src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblibfuzzer_sys-03a713efd07706bd.rlib(FuzzerFork.o):/rust/registry/src/github.com-1ecc6299db9ec823/libfuzzer-sys-0.4.2/libfuzzer/FuzzerFork.cpp:85: more undefined references to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()' follow
          /src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblibfuzzer_sys-03a713efd07706bd.rlib(FuzzerMutate.o): In function `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator+=(char const*)':
          /usr/local/bin/../include/c++/v1/string:1009: undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)'
          /src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblibfuzzer_sys-03a713efd07706bd.rlib(FuzzerMutate.o): In function `std::__1::vector<fuzzer::MutationDispatcher::Mutator, fuzzer::fuzzer_allocator<fuzzer::MutationDispatcher::Mutator> >::__recommend(unsigned long) const':
          /usr/local/bin/../include/c++/v1/vector:1026: undefined reference to `std::__1::__vector_base_common<true>::__throw_length_error() const'
          /src/toml-rs/fuzz/target/x86_64-unknown-linux-gnu/release/deps/liblibfuzzer_sys-03a713efd07706bd.rlib(FuzzerMutate.o): In function `std::__1::vector<fuzzer::MutationDispatcher::Mutator, fuzzer::fuzzer_allocator<fuzzer::MutationDispatcher::Mutator> >::__vallocate(unsigned long)':

Apparently, cargo fuzz build in the base image builder is different from cargo fuzz build run locally. Looks like it has something to do with the rust toolchain/clang (maybe)

Copy link
Contributor

@jonathanmetzman jonathanmetzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonathanmetzman jonathanmetzman merged commit 1f49a51 into google:master Jun 2, 2021
evverx added a commit to evverx/cargo-fuzz that referenced this pull request Jun 5, 2021
It should help to figure out how libFuzzer is built and linked
against, which in turn should be useful in scenarios like
google/oss-fuzz#5867 (comment)
evverx added a commit to evverx/cargo-fuzz that referenced this pull request Jun 5, 2021
It should help to figure out how libFuzzer is built and linked
against, which in turn should be useful in scenarios like
google/oss-fuzz#5867 (comment)
evverx added a commit to evverx/cargo-fuzz that referenced this pull request Jun 5, 2021
It should help to figure out how libFuzzer is built and linked
against, which in turn should be useful in scenarios like
google/oss-fuzz#5867 (comment)
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