fuzzbench icon indicating copy to clipboard operation
fuzzbench copied to clipboard

Build error in `libfuzzer_dataflow` integration

Open DonggeLiu opened this issue 3 years ago • 5 comments

One build command that runs in /src/openss/ reads:

./config --prefix=/src/curl_install --debug enable-fuzz-libfuzzer -DPEDANTIC -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION no-shared enable-tls1_3 enable-rc5 enable-md2 enable-ssl3 enable-ec_nistp_64_gcc_128 enable-ssl3-method enable-nextprotoneg enable-weak-ssl-ciphers -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -pthread -Wl,--no-as-needed -Wl,-ldl -Wl,-lm -Wno-unused-command-line-argument -O3 -fsanitize=fuzzer-no-link -fsanitize-coverage=trace-loads,trace-stores /weak.o -fno-sanitize=alignment

This command fails with the following output:

Operating system: x86_64-whatever-linux2
Configuring for linux-x86_64-clang
target already defined - linux-x86_64-clang (offending arg: /weak.o)

To fix it, the command needs to be changed to:

./Configure --prefix=/src/curl_install --debug enable-fuzz-libfuzzer -DPEDANTIC -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION no-shared enable-tls1_3 enable-rc5 enable-md2 enable-ssl3 enable-ec_nistp_64_gcc_128 enable-ssl3-method enable-nextprotoneg enable-weak-ssl-ciphers -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -pthread -Wl,--no-as-needed -Wl,-ldl -Wl,-lm -Wno-unused-command-line-argument -O3 -fsanitize=fuzzer-no-link -fsanitize-coverage=trace-loads,trace-stores /weak.o -fno-sanitize=alignment os/compiler:linux-x86_64-clang

That is:

  • Replace the leading ./config with ./Configure, and
  • Append os/compiler:linux-x86_64-clang at the end.

However, I am not sure what is the best way to fix it in its Dockerfile.

DonggeLiu avatar Jul 14 '22 01:07 DonggeLiu

Why do we still need libfuzzer_dataflow?

jonathanmetzman avatar Jul 18 '22 17:07 jonathanmetzman

Because we want to compare its performance with Centipede: They use the same dataflow tracing algorithm to assist fuzzing but rely on different engineering backend.

DonggeLiu avatar Jul 18 '22 23:07 DonggeLiu

Is this hard to fix because the dockerfile calls into scripts that are kept in the curl repo? Can you make a copy of the script (put it in curl/third_party because it is third_party code) and patch it as needed.

jonathanmetzman avatar Jul 19 '22 14:07 jonathanmetzman

Ah thanks! Yesterday I was looking at the code and wondering how it could be done. I will do as you suggested!

DonggeLiu avatar Jul 21 '22 02:07 DonggeLiu

Hmm... It seems my hack did not fix the error but deferred it to later build steps. Got a lot of strange ld errors like:

/usr/bin/ld: Dwarf Error: found dwarf version '304', this reader only handles version '2', '3', '4'.

Not sure how to fix it now.

DonggeLiu avatar Jul 21 '22 10:07 DonggeLiu