sslab-gatech / fuzzification

We hinder fuzzing
64 stars 9 forks source link

Cannot compile tutorial's *_bump due to lack of compile command line #3

Open lawyer61 opened 5 years ago

lawyer61 commented 5 years ago

As you see, the antifuzz-tutorial contains a compile tutorial of binutils-2.23 , the binary readelf,objdump,objcpy,nm-new has the source code -> ir code command line , e.g.

COMMAND["objdump.o"] = 'afl-clang-fast -DHAVE_CONFIG_H -I. -I. -I. -I../bfd -I./../bfd -I./../include -DLOCALEDIR="\\"/usr/local/share/locale\\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -O0 -flto -std=c11 -lpthread -MT objdump.o -MD -MP -MF .deps/objdump.Tpo -c -o objdump.o -DOBJDUMP_PRIVATE_VECTORS="" ./{SRC} 2> /tmp/makeout'

but if I want to compile the binary with speedbump, it will lead to :(See antifuzz-tutorial/temp/binutils/build-objdump.sh, this is generated by src/compile.py)

elif [ "$3" == "slow" ]
  then
    #afl-clang-fast -DHAVE_CONFIG_H -I.  -I. -I. -I../bfd -I./../bfd -I./../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -O0 -flto -std=c11 -lpthread -MT objdump.o -MD -MP -MF .deps/objdump.Tpo -c -o objdump.o -DOBJDUMP_PRIVATE_VECTORS="" ./objdump.c  1> /dev/null 2> /tmp/makeout
    cp /home/lawyer61/AIFuzz/fuzzification/src/llvm_pass/bump/delaysrc/delay_$2.o ./delay.o
    /bin/bash ./libtool --tag=CC   --mode=link afl-clang-fast -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -O0 -flto -std=c11 -lpthread  -flto  -o $1 delay.o huge_dummy.o objdump_bump.o dwarf_bump.o prdbg_bump.o rddbg_bump.o debug_bump.o stabs_bump.o ieee_bump.o rdcoff_bump.o bucomm_bump.o version_bump.o filemode_bump.o elfcomm_bump.o  ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a  -lz 1> /dev/null 

The question is, all the *_bump.o file (except the objdump_bump.o) will fail in src/.work3/make_bump.sh:

opt -load ./libSkeletonPass_bump.so -SkeletonPass <$1.o> $1_bump.o ...

opt: <stdin>:1:1: error: expected top-level entity
(Garbled below)

So we will fail in the antifuzz-all.py when opening objdump_d30_r4_o3(for example)

Traceback (most recent call last):
  File "antifuzz_all.py", line 587, in <module>
    bump_depay, bump_ratio, fname, c_overhead, s_overhead = speedbump()
  File "antifuzz_all.py", line 415, in speedbump
    c_overhead, s_overhead = _ret_overhead(gen_pn)
  File "antifuzz_all.py", line 508, in _ret_overhead
    newfile_size = os.path.getsize(gen_pn)
  File "/usr/lib/python2.7/genericpath.py", line 57, in getsize
    return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory: '../antifuzz-tutorial/temp/binutils/objdump_d50_r17_o3'
jinhojun commented 4 years ago

Thanks for the report. We confirmed the problem.

We will fix the problem shortly.