curl-fuzzer icon indicating copy to clipboard operation
curl-fuzzer copied to clipboard

clang: error: unsupported option --with-fuzzer-lib

Open bagder opened this issue 1 year ago • 2 comments

It's been a while since I built the fuzzer and now when I run mainline.sh it exits in the OpenSSL build pretty quickly with this error message:

making all in crypto...
make[1]: Entering directory '/home/dast/src/curl-fuzzer/openssl/crypto'
...
clang -I. -I.. -I../include  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H --debug --with-fuzzer-lib=/usr/lib/libFuzzingEngine -DPEDANTIC -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address,fuzzer-no-link -fno-sanitize=alignment -m64 -DL_ENDIAN -O3 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token  -Wno-extended-offsetof -Qunused-arguments -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION  -c -o cryptlib.o cryptlib.c
clang: error: unsupported option '--with-fuzzer-lib=/usr/lib/libFuzzingEngine'
make[1]: *** [<builtin>: cryptlib.o] Error 1
make[1]: Leaving directory '/home/dast/src/curl-fuzzer/openssl/crypto'
make: *** [Makefile:287: build_crypto] Error 1
+ exit 1

This is clang 16, I also tried forcing it to use 14 but it made no difference. I can't recall having seen this before nor how I overcome this in the past. Any clues?

bagder avatar Jan 21 '24 11:01 bagder

How bizarre. I'd recommend going via the ossfuzz infra helper in the meantime, but I'll investigate.

cmeister2 avatar Jan 21 '24 11:01 cmeister2

The method I use (and that I should really document in the REPRODUCING guide) is:

  • Use ossfuzz
  • python3 infra/helper.py build_image curl
  • python3 infra/helper.py build_fuzzers curl
  • Copy the clusterfuzz test case into the ossfuzz build/out directory
  • python3 infra/helper.py shell which drops you into a Docker container
  • export GDBMODE=1
  • Run compile, which will compile the fuzzers for you and also compile a version of GDB that will work
  • Run gdb /out/<thefuzzeryouwanttorun>
  • In gdb, break __asan::ReportGenericError
  • then, run run /out/clusterfuzz-<name of test case>

cmeister2 avatar Jan 21 '24 12:01 cmeister2