rust-fuzz/afl.rs

"cargo install cargo-afl" Installation error

Taolaw opened this issue · 5 comments

Taolaw commented

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.

Compiling clap v4.4.8
error: failed to run custom build command for `cargo-afl v0.14.5`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/tmp/cargo-installG9CX3U/release/build/cargo-afl-031af1f025bd5769/build-script-build` (exit status: 101)
  --- stdout
  [*] Compiling AFL++ for OS Linux on ARCH x86_64
  rm -rf afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze afl-fuzz-document afl-as as afl-g++ afl-clang afl-clang++ *.o src/*.o *~ a.out core core.[1-9][0-9]* *.stackdump .test .test1 .test2 test-instr .test-instr0 .test-instr1 afl-cs-proxy afl-qemu-trace afl-gcc-fast afl-g++-fast ld *.so *.8 test/unittests/*.o test/unittests/unit_maybe_alloc test/unittests/preallocable .afl-* afl-gcc afl-g++ afl-clang afl-clang++ test/unittests/unit_hash test/unittests/unit_rand *.dSYM lib*.a
  make -f GNUmakefile.llvm clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa'
  [+] llvm_mode detected llvm 10+, enabling neverZero implementation and c++14
  [+] llvm_mode detected llvm 11+, enabling afl-lto LTO implementation
  rm -f *.o *.so *~ a.out core core.[1-9][0-9]* .test2 test-instr .test-instr0 .test-instr1 *.dwo
  rm -f ./afl-cc ./afl-compiler-rt.o ./afl-compiler-rt-32.o ./afl-compiler-rt-64.o  ./afl-llvm-pass.so ./SanitizerCoveragePCGUARD.so ./split-compares-pass.so ./split-switches-pass.so ./cmplog-routines-pass.so ./cmplog-instructions-pass.so ./cmplog-switches-pass.so ./afl-llvm-dict2file.so ./compare-transform-pass.so ./afl-ld-lto ./afl-llvm-lto-instrumentlist.so ./SanitizerCoverageLTO.so afl-common.o ./afl-c++ ./afl-lto ./afl-lto++ ./afl-clang-lto* ./afl-clang-fast* ./afl-clang*.8 ./ld ./afl-ld ./afl-compiler-rt*.o ./afl-llvm-rt*.o instrumentation/*.o
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa'
  make -f GNUmakefile.gcc_plugin clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa'
  rm -f *.o *.so *~ a.out core core.[1-9][0-9]* test-instr .test-instr0 .test-instr1 .test2
  rm -f ./afl-gcc-pass.so ./afl-gcc-cmplog-pass.so ./afl-gcc-cmptrs-pass.so ./afl-compiler-rt.o ./afl-compiler-rt-32.o ./afl-compiler-rt-64.o afl-common.o ./afl-g++-fast ./afl-g*-fast.8 instrumentation/*.o
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa'
  make -C utils/libdislocator clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/libdislocator'
  rm -f *.o *.so *~ a.out core core.[1-9][0-9]*
  rm -f ../../libdislocator.so
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/libdislocator'
  make -C utils/libtokencap clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/libtokencap'
  rm -f *.o *.so *~ a.out core core.[1-9][0-9]*
  rm -fv ../../libtokencap.so
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/libtokencap'
  make -C utils/aflpp_driver clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/aflpp_driver'
  rm -f *.o libAFLDriver*.a libAFLQemuDriver.a aflpp_qemu_driver_hook.so *~ core aflpp_driver_test
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/aflpp_driver'
  make -C utils/afl_network_proxy clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/afl_network_proxy'
  rm -f afl-network-client afl-network-server *~ core
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/afl_network_proxy'
  make -C utils/socket_fuzzing clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/socket_fuzzing'
  rm -f socketfuzz32.so socketfuzz64.so
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/socket_fuzzing'
  make -C utils/argv_fuzzing clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/argv_fuzzing'
  rm -f argvfuzz32.so argvfuzz64.so argv_fuzz_demo argv_fuzz_persistent_demo
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/argv_fuzzing'
  make -C utils/plot_ui clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/plot_ui'
  rm -f afl-plot-ui
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/utils/plot_ui'
  make -C qemu_mode/unsigaction clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/qemu_mode/unsigaction'
  rm -f unsigaction.so
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/qemu_mode/unsigaction'
  make -C qemu_mode/fastexit clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/qemu_mode/fastexit'
  rm -f fastexit.so
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/qemu_mode/fastexit'
  make -C qemu_mode/libcompcov clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/qemu_mode/libcompcov'
  rm -f *.o *.so *~ a.out core core.[1-9][0-9]*
  rm -f ../../libcompcov.so compcovtest
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/qemu_mode/libcompcov'
  make -C qemu_mode/libqasan clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/qemu_mode/libqasan'
  rm -f *.o *.so *~ a.out core core.[1-9][0-9]*
  rm -f ../../libqasan.so
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/qemu_mode/libqasan'
  make -C frida_mode clean
  make[1]: Entering directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/frida_mode'
  rm -rf /tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/frida_mode/build/
  make[1]: Leaving directory '/tmp/cargo-installG9CX3U/release/build/cargo-afl-02bd07ba3b19b809/out/.tmpv00psa/frida_mode'
  rm -rf nyx_mode/packer/linux_initramfs/init.cpio.gz nyx_mode/libnyx/libnyx/target/release/* nyx_mode/QEMU-Nyx/x86_64-softmmu/qemu-system-x86_64
  rm -rf coresight_mode/coresight_trace
  rm -rf qemu_mode/qemuafl
  rm -rf unicorn_mode/unicornafl
  [!] Note: skipping x86 compilation checks (AFL_NO_X86 set).
  [+] shmat seems to be working.
  [+] Python 3.10.12 support seems to be working.
  [+] 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
  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-sharedmem.c -o src/afl-sharedmem.o
  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-forkserver.c -o src/afl-forkserver.o
  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\"  -Iinclude -c src/afl-performance.c -o src/afl-performance.o
  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 src/afl-fuzz-bitmap.c src/afl-fuzz.c src/afl-fuzz-cmplog.c src/afl-fuzz-extras.c src/afl-fuzz-init.c src/afl-fuzz-mutators.c src/afl-fuzz-one.c src/afl-fuzz-python.c src/afl-fuzz-queue.c src/afl-fuzz-redqueen.c src/afl-fuzz-run.c src/afl-fuzz-state.c src/afl-fuzz-stats.c src/afl-fuzz-statsd.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o afl-fuzz -DUSE_PYTHON -I/usr/include/python3.10 -I/usr/include/python3.10 -ldl -lrt -lm -lpython3.10 -lcrypt -ldl  -lm -lm  -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lpython3.10 -lcrypt -ldl  -lm -lm  -DPYTHON_VERSION="\"Python 3.10.12\"" -ldl -lrt -lm -lm

  --- stderr
  WARNING: dlopen() detected. To have coverage for a library that your target dlopen()'s this must either happen before __AFL_INIT() or you must use AFL_PRELOAD to preload all dlopen()'ed libraries!
  WARNING: dlopen() detected. To have coverage for a library that your target dlopen()'s this must either happen before __AFL_INIT() or you must use AFL_PRELOAD to preload all dlopen()'ed libraries!
  `.text.sancov.module_ctor_trace_pc_guard.2' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.2]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.2[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.44' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.44]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.44[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.86' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.86]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.86[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.237' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.237]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.237[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.511' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.511]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.511[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.608' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.608]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.608[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.687' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.687]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.687[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.761' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.761]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.761[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.814' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.814]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.814[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.844' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.844]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.844[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.892' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.892]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.892[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.1172' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.1172]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.1172[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.1459' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.1459]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.1459[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.1493' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.1493]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.1493[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.1877' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.1877]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.1877[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  `.text.sancov.module_ctor_trace_pc_guard.1912' referenced in section `.init_array.2[sancov.module_ctor_trace_pc_guard.1912]' of /tmp/lto-llvm-78b133.o: defined in discarded section `.text.sancov.module_ctor_trace_pc_guard.1912[sancov.module_ctor_trace_pc_guard]' of /tmp/lto-llvm-78b133.o
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [GNUmakefile:464: afl-fuzz] Error 1
  thread 'main' panicked at /home/fuzz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-afl-0.14.5/build.rs:91:5:
  assertion failed: status.success()
  stack backtrace:
     0:     0x559ac22c0f9c - std::backtrace_rs::backtrace::libunwind::trace::h67a838aed1f4d6ec
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
     1:     0x559ac22c0f9c - std::backtrace_rs::backtrace::trace_unsynchronized::h1d1786bb1962baf8
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x559ac22c0f9c - std::sys_common::backtrace::_print_fmt::h5a0b1f807a002d23
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:67:5
     3:     0x559ac22c0f9c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf84ab6ad0b91784c
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:44:22
     4:     0x559ac22e630c - core::fmt::rt::Argument::fmt::h28f463bd1fdabed5
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/fmt/rt.rs:138:9
     5:     0x559ac22e630c - core::fmt::write::ha37c23b175e921b3
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/fmt/mod.rs:1114:21
     6:     0x559ac22be35e - std::io::Write::write_fmt::haa1b000741bcbbe1
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/io/mod.rs:1763:15
     7:     0x559ac22c0d84 - std::sys_common::backtrace::_print::h1ff1030b04dfb157
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:47:5
     8:     0x559ac22c0d84 - std::sys_common::backtrace::print::hb982056c6f29541c
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:34:9
     9:     0x559ac22c2b13 - std::panicking::default_hook::{{closure}}::h11f92f82c62fbd68
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:272:22
    10:     0x559ac22c2834 - std::panicking::default_hook::hb8810fe276772c66
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:292:9
    11:     0x559ac22c3095 - std::panicking::rust_panic_with_hook::hd2f0efd2fec86cb0
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:731:13
    12:     0x559ac22c2f46 - std::panicking::begin_panic_handler::{{closure}}::h3651b7fc4f61d784
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:601:13
    13:     0x559ac22c14c6 - std::sys_common::backtrace::__rust_end_short_backtrace::hbc468e4b98c7ae04
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:170:18
    14:     0x559ac22c2ce2 - rust_begin_unwind
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
    15:     0x559ac226c295 - core::panicking::panic_fmt::h979245e2fdb2fabd
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
    16:     0x559ac226c333 - core::panicking::panic::hcad0f3a89a1b36aa
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:127:5
    17:     0x559ac2273721 - build_script_build::build_afl::hd92815afb34dd00a
    18:     0x559ac2273283 - build_script_build::main::h2a3be25f7bc9aab8
    19:     0x559ac2276cd3 - core::ops::function::FnOnce::call_once::h04eb37cfac437c9e
    20:     0x559ac226cff6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8a4e9d372bb86a59
    21:     0x559ac2274b79 - std::rt::lang_start::{{closure}}::hc3cfccf5e70a2124
    22:     0x559ac22badbb - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hf9057cfaeeb252e2
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:284:13
    23:     0x559ac22badbb - std::panicking::try::do_call::h629e203a624883e4
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:504:40
    24:     0x559ac22badbb - std::panicking::try::h7b61614724d6a4f1
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:468:19
    25:     0x559ac22badbb - std::panic::catch_unwind::h354ac1c0268491d8
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panic.rs:142:14
    26:     0x559ac22badbb - std::rt::lang_start_internal::{{closure}}::h919fee3c5ba8f617
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:148:48
    27:     0x559ac22badbb - std::panicking::try::do_call::h54583f67455bff32
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:504:40
    28:     0x559ac22badbb - std::panicking::try::hb0e12c4e01d39dc2
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:468:19
    29:     0x559ac22badbb - std::panic::catch_unwind::h367b6339e3ca9a3b
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panic.rs:142:14
    30:     0x559ac22badbb - std::rt::lang_start_internal::ha5ce8533eaa0fda8
                                 at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:148:20
    31:     0x559ac2274b57 - std::rt::lang_start::hc339d76d8bb7602a
    32:     0x559ac22747d5 - main
    33:     0x7fd3dd429d90 - __libc_start_call_main
                                 at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    34:     0x7fd3dd429e40 - __libc_start_main_impl
                                 at ./csu/../csu/libc-start.c:392:3
    35:     0x559ac226c9b5 - _start
    36:                0x0 - <unknown>
error: failed to compile `cargo-afl v0.14.5`, intermediate artifacts can be found at `/tmp/cargo-installG9CX3U`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

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
Taolaw commented
$ 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?

Taolaw commented

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!