Closed Taolaw closed 1 year ago
Hi, @Taolaw. I am sorry for the difficulty.
Usually, with problems like this, I try to determine whether AFL++ will build outright.
Could you please try the following?
git clone https://github.com/AFLplusplus/AFLplusplus
cd AFLplusplus
git checkout 7e67dc9d6938aadef19d5697a448cdf15a50172f
make
$ export LLVM_CONFIG=llvm-config-14
$ make
[*] Compiling AFL++ for OS Linux on ARCH x86_64
[*] Checking for the default compiler cc...
[*] Testing the PATH environment variable...
[*] Checking for the ability to compile x86 code...
[+] shmat seems to be working.
[+] Python 3.10.12 support seems to be working.
[+] Everything seems to be working, ready to compile. (cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0)
make -j -f GNUmakefile.llvm
make[1]: Entering directory '/home/fuzz/vuln_search/rust_fuzz/AFLplusplus'
[+] llvm_mode detected llvm 10+, enabling neverZero implementation and c++14
[+] llvm_mode detected llvm 11+, enabling afl-lto LTO implementation
[+] shmat seems to be working.
[*] Checking for working 'llvm-config'...
[*] Checking for working '/usr/lib/llvm-14/bin/clang'...
[*] Checking for matching versions of '/usr/lib/llvm-14/bin/clang' and 'llvm-config-14'
[*] We have llvm-config version 14.0.0 with a clang version 14.0.0, good.
[*] Checking for './afl-showmap'...
[+] All set and ready to build.
[*] Building 32-bit variant of the runtime (-m32)... failed (that's fine)
[*] Testing the CC wrapper and instrumentation output...
unset AFL_USE_ASAN AFL_USE_MSAN AFL_INST_RATIO; ASAN_OPTIONS=detect_leaks=0 AFL_QUIET=1 AFL_PATH=. AFL_LLVM_LAF_ALL=1 ./afl-cc -O3 -funroll-loops -fPIC -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DLLVM_BINDIR=\"/usr/lib/llvm-14/bin\" -DVERSION=\"++4.09a\" -DLLVM_LIBDIR=\"/usr/lib/llvm-14/lib\" -DLLVM_VERSION=\"14.0.0\" -DAFL_CLANG_FLTO=\"-flto=full\" -DAFL_REAL_LD=\"/usr/lib/llvm-14/bin/ld.lld\" -DAFL_CLANG_LDPATH=\"1\" -DAFL_CLANG_FUSELD=\"1\" -DCLANG_BIN=\"/usr/lib/llvm-14/bin/clang\" -DCLANGPP_BIN=\"/usr/lib/llvm-14/bin/clang++\" -DUSE_BINDIR=1 -Wno-unused-function -fdebug-prefix-map="/home/fuzz/vuln_search/rust_fuzz/AFLplusplus=llvm_mode" -Wno-deprecated ./test-instr.c -o test-instr
ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
[+] All right, the instrumentation seems to be working!
[+] All done! You can now use './afl-cc' to compile programs.
make[1]: Leaving directory '/home/fuzz/vuln_search/rust_fuzz/AFLplusplus'
make -f GNUmakefile.gcc_plugin
make[1]: Entering directory '/home/fuzz/vuln_search/rust_fuzz/AFLplusplus'
[+] shmat seems to be working.
[*] Checking for working 'cc'...
[*] Checking for gcc plugin development header files...
[*] Checking for './afl-showmap'...
[+] All set and ready to build.
[*] Building 32-bit variant of the runtime (-m32)... failed (that's fine)
[*] Testing the CC wrapper and instrumentation output...
unset AFL_USE_ASAN AFL_USE_MSAN; ASAN_OPTIONS=detect_leaks=0 AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. AFL_CC=cc ./afl-gcc-fast -O3 -g -funroll-loops -Wall -Iinclude -Wno-pointer-sign -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DGCC_VERSION=\"\" -DGCC_BINDIR=\"\" -Wno-unused-function ./test-instr.c -o test-instr -lrt
ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr </dev/null
echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
[+] All right, the instrumentation seems to be working!
[+] All done! You can now use './afl-gcc-fast' to compile programs.
make[1]: Leaving directory '/home/fuzz/vuln_search/rust_fuzz/AFLplusplus'
[*] Testing the CC wrapper afl-cc and its instrumentation output...
afl-cc++4.09a by Michal Zalewski, Laszlo Szekeres, Marc Heuse - mode: LLVM-PCGUARD
SanitizerCoveragePCGUARD++4.09a
[+] Instrumented 13 locations with no collisions (non-hardened mode) of which are 0 handled and 0 unhandled selects.
ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -q -m none -o .test-instr0 ./test-instr < /dev/null
echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
[+] All right, the instrumentation of afl-cc seems to be working!
[+] Main compiler 'afl-cc' successfully built!
[+] LLVM mode for 'afl-cc' successfully built!
[+] LLVM LTO mode for 'afl-cc' successfully built!
[+] gcc_plugin for 'afl-cc' successfully built!
[+] All done! Be sure to review the README.md - it's pretty short and useful.
NOTE: If you can read this, your terminal probably uses white background.
This will make the UI hard to read. See docs/status_screen.md for advice.
make -C utils/aflpp_driver
make[1]: Entering directory '/home/fuzz/vuln_search/rust_fuzz/AFLplusplus/utils/aflpp_driver'
Note: Optional aflpp_qemu_driver_hook.o not built.
Note: Optional aflpp_qemu_driver_hook.so not built.
make[1]: Leaving directory '/home/fuzz/vuln_search/rust_fuzz/AFLplusplus/utils/aflpp_driver'
Build Summary:
[+] afl-fuzz and supporting tools successfully built
[+] LLVM basic mode successfully built
[+] LLVM mode successfully built
[+] LLVM LTO mode successfully built
[+] gcc_mode successfully built
It seems everything is fine. I executed the commands as mentioned above, added an environment variable export LLVM_CONFIG=llvm-config-14
and everything looks normal from the results. However, when I tried installing cargo-afl
with this environment variable added, the aforementioned error reappeared.
Regarding your original output:
[+] Everything seems to be working, ready to compile. (Ubuntu clang version 14.0.0-1ubuntu1.1)
afl-clang-fast -O2 -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/lib/afl\" -DBIN_PATH=\"/bin\" -DDOC_PATH=\"/share/doc/afl\" -flto=full -c src/afl-common.c -o src/afl-common.o
The fact that afl-clang-fast
appears there doesn't look right to me. Is it possible you have CC
set?
Thank you. It seems the problem was on my end. Some inexplicably set environment variables disrupted the installation process. I made a foolish mistake again. Thanks for your careful response!
No problem at all!
OS: ubuntu22.04 rust version: v1.74.0 When I follow the instructions in the documentation to perform the installation, I encounter the following error.