afl.rs icon indicating copy to clipboard operation
afl.rs copied to clipboard

build failed with apple clang 12 on macOS

Open gentcys opened this issue 4 years ago • 3 comments

run cargo check --all inside tikv project, and error occurred.

tikv git:(update_dependency) ✗ RUST_BACKTRACE=1 cargo check --all
   Compiling afl v0.6.0
   Compiling librocksdb_sys v0.1.0 (https://github.com/tikv/rust-rocksdb.git#0876316d)
error: failed to run custom build command for `afl v0.6.0`

Caused by:
  process didn't exit successfully: `/Users/gentcys/Codes/personal/tikv/target/debug/build/afl-ec701a85aa8db2c6/build-script-build` (exit code: 101)
--- stdout
rm -f afl-gcc afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze afl-as as afl-g++ afl-clang afl-clang++ *.o *~ a.out core core.[1-9][0-9]* *.stackdump test .test test-instr .test-instr0 .test-instr1 qemu_mode/qemu-2.10.0.tar.bz2 afl-qemu-trace
rm -rf out_dir qemu_mode/qemu-2.10.0
/Library/Developer/CommandLineTools/usr/bin/make -C llvm_mode clean
rm -f *.o *.so *~ a.out core core.[1-9][0-9]* test-instr .test-instr0 .test-instr1
rm -f ../afl-clang-fast ../afl-llvm-rt.o ../afl-llvm-rt-32.o ../afl-llvm-rt-64.o ../afl-clang-fast++
/Library/Developer/CommandLineTools/usr/bin/make -C libdislocator clean
rm -f *.o *.so *~ a.out core core.[1-9][0-9]*
rm -f libdislocator.so
/Library/Developer/CommandLineTools/usr/bin/make -C libtokencap clean
rm -f *.o *.so *~ a.out core core.[1-9][0-9]*
rm -f libtokencap.so
[*] Checking for the ability to compile x86 code...
[+] Everything seems to be working, ready to compile.
cc -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/lib/afl\" -DDOC_PATH=\"/share/doc/afl\" -DBIN_PATH=\"/bin\" afl-gcc.c -o afl-gcc
set -e; for i in afl-g++ afl-clang afl-clang++; do ln -sf afl-gcc $i; done
cc -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/lib/afl\" -DDOC_PATH=\"/share/doc/afl\" -DBIN_PATH=\"/bin\" afl-fuzz.c -o afl-fuzz
cc -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/lib/afl\" -DDOC_PATH=\"/share/doc/afl\" -DBIN_PATH=\"/bin\" afl-showmap.c -o afl-showmap
cc -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/lib/afl\" -DDOC_PATH=\"/share/doc/afl\" -DBIN_PATH=\"/bin\" afl-tmin.c -o afl-tmin
cc -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/lib/afl\" -DDOC_PATH=\"/share/doc/afl\" -DBIN_PATH=\"/bin\" afl-gotcpu.c -o afl-gotcpu
cc -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/lib/afl\" -DDOC_PATH=\"/share/doc/afl\" -DBIN_PATH=\"/bin\" afl-analyze.c -o afl-analyze
cc -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/lib/afl\" -DDOC_PATH=\"/share/doc/afl\" -DBIN_PATH=\"/bin\" afl-as.c -o afl-as
ln -sf afl-as as
[*] Testing the CC wrapper and instrumentation output...
unset AFL_USE_ASAN AFL_USE_MSAN; AFL_QUIET=1 AFL_INST_RATIO=100 AFL_PATH=. ./afl-clang -O3 -funroll-loops -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -DAFL_PATH=\"/lib/afl\" -DDOC_PATH=\"/share/doc/afl\" -DBIN_PATH=\"/bin\" test-instr.c -o test-instr
echo 0 | ./afl-showmap -m none -q -o .test-instr0 ./test-instr
echo 1 | ./afl-showmap -m none -q -o .test-instr1 ./test-instr

Oops, the instrumentation does not seem to be behaving correctly!

Please ping <[email protected]> to troubleshoot the issue.


--- stderr
make: *** [test_build] Error 1
thread 'main' panicked at 'assertion failed: status.success()', /Users/gentcys/.cargo/registry/src/github.com-1ecc6299db9ec823/afl-0.6.0/build.rs:33:5
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
   7: build_script_build::build_afl
   8: build_script_build::main
   9: std::rt::lang_start::{{closure}}
  10: std::rt::lang_start_internal
  11: std::rt::lang_start
  12: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

gentcys avatar Sep 17 '20 09:09 gentcys

I think it's worth bumping our aflplusplus git submodule in the afl.rs repo to the latest version and seeing if the error still persists. We're a few versions behind https://github.com/AFLplusplus/AFLplusplus/blob/stable/docs/Changelog.md

frewsxcv avatar Sep 17 '20 12:09 frewsxcv

@frewsxcv just clone afl(0.9.0) repo to my laptop and cargo check --all works well. But TiKV still depend on 0.6.0. I don't know what changes between two versions and how does new version fix this problem.

➜  afl.rs git:(master) git submodule update --init
Submodule 'AFLplusplus' (https://github.com/AFLplusplus/AFLplusplus.git) registered for path 'AFLplusplus'
Cloning into '/Users/gentcys/afl.rs/AFLplusplus'...
Submodule path 'AFLplusplus': checked out 'ddea300822e5628482366ecb38adac31717d69bc'
➜  afl.rs git:(master) git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
➜  afl.rs git:(master) cargo check --all
   Compiling afl v0.9.0 (/Users/gentcys/afl.rs)
    Finished dev [unoptimized + debuginfo] target(s) in 19.29s

gentcys avatar Sep 17 '20 13:09 gentcys

if you're wondering how to change the 0.6 requirement, you can modify this line:

https://github.com/tikv/tikv/blob/9a81ea6bb70cba355fc669b4f92eb017b511cf0b/fuzz/fuzzer-afl/Cargo.toml#L16

to:

afl = { path = "/path/to/afl.rs" }

frewsxcv avatar Sep 18 '20 13:09 frewsxcv