diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Android.bp | 140 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | docs/ChangeLog | 15 | ||||
-rw-r--r-- | include/config.h | 2 | ||||
-rw-r--r-- | libdislocator/libdislocator.so.c | 6 | ||||
-rw-r--r-- | llvm_mode/afl-clang-fast.c | 6 | ||||
-rwxr-xr-x | qemu_mode/build_qemu_support.sh | 5 | ||||
-rw-r--r-- | qemu_mode/patches/afl-qemu-common.h | 4 | ||||
-rw-r--r-- | qemu_mode/patches/afl-qemu-tcg-inl.h | 4 | ||||
-rw-r--r-- | qemu_mode/unsigaction/Makefile | 2 | ||||
-rw-r--r-- | src/afl-fuzz-bitmap.c | 3 | ||||
-rw-r--r-- | src/afl-fuzz-init.c | 7 | ||||
-rw-r--r-- | src/afl-gotcpu.c | 2 | ||||
-rwxr-xr-x | unicorn_mode/build_unicorn_support.sh | 8 |
16 files changed, 185 insertions, 30 deletions
diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 05bd3b04..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "unicorn_mode/unicorn"] - path = unicorn_mode/unicorn - url = https://github.com/vanhauser-thc/unicorn.git diff --git a/Android.bp b/Android.bp new file mode 100644 index 00000000..9fdf6f04 --- /dev/null +++ b/Android.bp @@ -0,0 +1,140 @@ +cc_defaults { + name: "afl-defaults", + + cflags: [ + "-funroll-loops", + "-Wno-pointer-sign", + "-Wno-pointer-arith", + "-Wno-sign-compare", + "-Wno-unused-parameter", + "-Wno-unused-function", + "-Wno-format", + "-Wno-user-defined-warnings", + "-DUSE_TRACE_PC=1", + "-DBIN_PATH=\"out/host/linux-x86/bin\"", + "-DDOC_PATH=\"out/host/linux-x86/shared/doc/afl\"", + "-D__USE_GNU", + ], +} + +cc_binary { + name: "afl-fuzz", + static_executable: true, + host_supported: true, + + defaults: [ + "afl-defaults", + ], + + srcs: [ + "afl-fuzz.c", + ], +} + +cc_binary { + name: "afl-showmap", + static_executable: true, + host_supported: true, + + defaults: [ + "afl-defaults", + ], + + srcs: [ + "afl-showmap.c", + ], +} + +cc_binary { + name: "afl-tmin", + static_executable: true, + host_supported: true, + + defaults: [ + "afl-defaults", + ], + + srcs: [ + "afl-tmin.c", + ], +} + +cc_binary { + name: "afl-analyze", + static_executable: true, + host_supported: true, + + defaults: [ + "afl-defaults", + ], + + srcs: [ + "afl-analyze.c", + ], +} + +cc_binary { + name: "afl-gotcpu", + static_executable: true, + host_supported: true, + + defaults: [ + "afl-defaults", + ], + + srcs: [ + "afl-gotcpu.c", + ], +} + +cc_binary_host { + name: "afl-clang-fast", + static_executable: true, + + defaults: [ + "afl-defaults", + ], + + cflags: [ + "-D__ANDROID__", + "-DAFL_PATH=\"out/host/linux-x86/lib64\"", + ], + + srcs: [ + "llvm_mode/afl-clang-fast.c", + ], +} + +cc_binary_host { + name: "afl-clang-fast++", + static_executable: true, + + defaults: [ + "afl-defaults", + ], + + cflags: [ + "-D__ANDROID__", + "-DAFL_PATH=\"out/host/linux-x86/lib64\"", + ], + + srcs: [ + "llvm_mode/afl-clang-fast.c", + ], +} + +cc_library_static { + name: "afl-llvm-rt", + compile_multilib: "both", + vendor_available: true, + host_supported: true, + recovery_available: true, + + defaults: [ + "afl-defaults", + ], + + srcs: [ + "llvm_mode/afl-llvm-rt.o.c", + ], +} diff --git a/Makefile b/Makefile index ab70e9cb..1247ba83 100644 --- a/Makefile +++ b/Makefile @@ -310,7 +310,7 @@ all_done: test_build .NOTPARALLEL: clean clean: - rm -f $(PROGS) libradamsa.so 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 qemu_mode/qemu-3.1.1.tar.xz afl-qemu-trace afl-gcc-fast afl-gcc-pass.so afl-gcc-rt.o afl-g++-fast *.so *.8 + rm -f $(PROGS) libradamsa.so 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 qemu_mode/qemu-3.1.1.tar.xz afl-qemu-trace afl-gcc-fast afl-gcc-pass.so afl-gcc-rt.o afl-g++-fast *.so *.8 rm -rf out_dir qemu_mode/qemu-3.1.1 *.dSYM */*.dSYM -$(MAKE) -C llvm_mode clean -$(MAKE) -C gcc_plugin clean @@ -319,7 +319,7 @@ clean: $(MAKE) -C qemu_mode/unsigaction clean $(MAKE) -C qemu_mode/libcompcov clean $(MAKE) -C src/third_party/libradamsa/ clean - $(MAKE) -C unicorn_mode/unicorn clean + -$(MAKE) -C unicorn_mode/unicorn clean distrib: all radamsa -$(MAKE) -C llvm_mode diff --git a/README.md b/README.md index 09df08c6..bb98357e 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@  - Release Version: 2.58c + Release Version: 2.59c - Github Version: 2.58d + Github Version: 2.59d includes all necessary/interesting changes from Google's afl 2.56b diff --git a/docs/ChangeLog b/docs/ChangeLog index 992370c6..5fd004b1 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -13,9 +13,17 @@ Want to stay in the loop on major new features? Join our mailing list by sending a mail to <afl-users+subscribe@googlegroups.com>. ----------------------- -Version ++2.58d (dev): ----------------------- +-------------------------- +Version ++2.59d (develop): +-------------------------- + + - your patch? :-) + + + +-------------------------- +Version ++2.59c (release): +-------------------------- - qbdi_mode: fuzz android native libraries via QBDI framework - unicorn_mode: switched to the new unicornafl, thanks domenukk @@ -42,6 +50,7 @@ Version ++2.58d (dev): - added regex.dictionary - qemu and unicorn download scripts now try to download until the full download succeeded. f*ckin travis fails downloading 40% of the time! + - more support for Android (please test!) - added the few Android stuff we didnt have already from Google afl repository - removed unnecessary warnings diff --git a/include/config.h b/include/config.h index 29bdf048..e0b2555b 100644 --- a/include/config.h +++ b/include/config.h @@ -26,7 +26,7 @@ /* Version string: */ -#define VERSION "++2.58d" // c = release, d = volatile github dev +#define VERSION "++2.59d" // c = release, d = volatile github dev /****************************************************** * * diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index 33985ce9..0eb3f628 100644 --- a/libdislocator/libdislocator.so.c +++ b/libdislocator/libdislocator.so.c @@ -130,7 +130,7 @@ static u8 alloc_verbose, /* Additional debug messages */ static __thread size_t total_mem; /* Currently allocated mem */ static __thread u32 call_depth; /* To avoid recursion via fprintf() */ -static u32 alloc_canary; +static u32 alloc_canary; /* This is the main alloc function. It allocates one page more than necessary, sets that tailing page to PROT_NONE, and then increments the return address @@ -348,10 +348,10 @@ int posix_memalign(void** ptr, size_t align, size_t len) { return 0; } - + size_t rem = len % align; if (rem) len += align - rem; - + *ptr = __dislocator_alloc(len); if (*ptr && len) memset(*ptr, ALLOC_CLOBBER, len); diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c index e89b6183..a262e998 100644 --- a/llvm_mode/afl-clang-fast.c +++ b/llvm_mode/afl-clang-fast.c @@ -358,6 +358,7 @@ static void edit_params(u32 argc, char** argv) { } + //#ifndef __ANDROID__ // not sure, we might need these ifdefs for Android switch (bit_mode) { case 0: @@ -382,6 +383,8 @@ static void edit_params(u32 argc, char** argv) { } + //#endif + } cc_params[cc_par_cnt] = NULL; @@ -441,7 +444,10 @@ int main(int argc, char** argv) { } + //#ifndef __ANDROID__ // not sure this is needed for Android, so at the moment + //we rather keep this out find_obj(argv[0]); + //#endif edit_params(argc, argv); diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index c3983aa1..afd82f72 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -243,10 +243,9 @@ else fi echo "[+] Building libcompcov ..." -make -C libcompcov +make -C libcompcov && echo "[+] libcompcov ready" echo "[+] Building unsigaction ..." -make -C unsigaction -echo "[+] libcompcov ready" +make -C unsigaction && echo "[+] unsigaction ready" echo "[+] All done for qemu_mode, enjoy!" exit 0 diff --git a/qemu_mode/patches/afl-qemu-common.h b/qemu_mode/patches/afl-qemu-common.h index 2c1939aa..bddf0515 100644 --- a/qemu_mode/patches/afl-qemu-common.h +++ b/qemu_mode/patches/afl-qemu-common.h @@ -79,8 +79,8 @@ void afl_debug_dump_saved_regs(); void afl_persistent_loop(); void tcg_gen_afl_call0(void *func); -void tcg_gen_afl_compcov_log_call(void *func, target_ulong cur_loc, - TCGv arg1, TCGv arg2); +void tcg_gen_afl_compcov_log_call(void *func, target_ulong cur_loc, TCGv arg1, + TCGv arg2); void tcg_gen_afl_maybe_log_call(target_ulong cur_loc); diff --git a/qemu_mode/patches/afl-qemu-tcg-inl.h b/qemu_mode/patches/afl-qemu-tcg-inl.h index 33e0d2a7..8ac993a2 100644 --- a/qemu_mode/patches/afl-qemu-tcg-inl.h +++ b/qemu_mode/patches/afl-qemu-tcg-inl.h @@ -376,8 +376,8 @@ void tcg_gen_afl_call0(void *func) { } -void tcg_gen_afl_compcov_log_call(void *func, target_ulong cur_loc, - TCGv arg1, TCGv arg2) { +void tcg_gen_afl_compcov_log_call(void *func, target_ulong cur_loc, TCGv arg1, + TCGv arg2) { int i, real_args, nb_rets, pi; unsigned sizemask, flags; diff --git a/qemu_mode/unsigaction/Makefile b/qemu_mode/unsigaction/Makefile index 02dc2c79..5e9e2207 100644 --- a/qemu_mode/unsigaction/Makefile +++ b/qemu_mode/unsigaction/Makefile @@ -18,7 +18,7 @@ ifndef AFL_NO_X86 all: lib_i386 lib_amd64 lib_i386: - $(CC) -m32 -fPIC -shared unsigaction.c -o unsigaction32.so || echo "Cannot build unsigation32" + @$(CC) -m32 -fPIC -shared unsigaction.c -o unsigaction32.so 2>/dev/null ; if [ "$$?" = "0" ]; then echo "unsigaction32 build success"; else echo "unsigaction32 build failure (that's fine)"; fi lib_amd64: $(CC) -fPIC -shared unsigaction.c -o unsigaction64.so diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c index 8f00611c..c1aeb9ac 100644 --- a/src/afl-fuzz-bitmap.c +++ b/src/afl-fuzz-bitmap.c @@ -685,13 +685,14 @@ u8 save_if_interesting(char** argv, void* mem, u32 len, u8 fault) { ++unique_crashes; if (infoexec) { // if the user wants to be informed on new crashes - do #if !TARGET_OS_IPHONE - // that + // that if (system(infoexec) == -1) hnb += 0; // we dont care if system errors, but we dont want a // compiler warning either #else WARNF("command execution unsupported"); #endif + } last_crash_time = get_cur_time(); diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index c91b7bb7..825169cf 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -1905,9 +1905,10 @@ void check_binary(u8* fname) { #else #if !defined(__arm__) && !defined(__arm64__) - if ((f_data[0] != 0xCF || f_data[1] != 0xFA || f_data[2] != 0xED) - && (f_data[0] != 0xCA || f_data[1] != 0xFE || f_data[2] != 0xBA)) - FATAL("Program '%s' is not a 64-bit or universal Mach-O binary", target_path); + if ((f_data[0] != 0xCF || f_data[1] != 0xFA || f_data[2] != 0xED) && + (f_data[0] != 0xCA || f_data[1] != 0xFE || f_data[2] != 0xBA)) + FATAL("Program '%s' is not a 64-bit or universal Mach-O binary", + target_path); #endif #endif /* ^!__APPLE__ */ diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c index c6d71bb2..0f53fbd6 100644 --- a/src/afl-gotcpu.c +++ b/src/afl-gotcpu.c @@ -212,7 +212,7 @@ int main(int argc, char** argv) { if (util_perc < 110) { - SAYF(" Core #%u: " cLGN "AVAILABLE\n" cRST, i); + SAYF(" Core #%u: " cLGN "AVAILABLE" cRST "(%u%%)\n", i, util_perc); exit(0); } else if (util_perc < 250) { diff --git a/unicorn_mode/build_unicorn_support.sh b/unicorn_mode/build_unicorn_support.sh index 707e47bb..1c176bca 100755 --- a/unicorn_mode/build_unicorn_support.sh +++ b/unicorn_mode/build_unicorn_support.sh @@ -89,7 +89,7 @@ if [ "$PLT" = "NetBSD" ] || [ "$PLT" = "OpenBSD" ]; then TARCMD=gtar fi -for i in wget $PYTHONBIN automake autoconf $MAKECMD $TARCMD; do +for i in wget $PYTHONBIN automake autoconf git $MAKECMD $TARCMD; do T=`which "$i" 2>/dev/null` @@ -124,8 +124,10 @@ fi echo "[+] All checks passed!" echo "[*] Making sure unicornafl is checked out" -git submodule init || exit 1 -git submodule update || exit 1 +rm -rf unicorn # workaround for travis ... sadly ... +#test -d unicorn && { cd unicorn && { git stash ; git pull ; cd .. ; } } +test -d unicorn || git clone https://github.com/vanhauser-thc/unicorn +test -d unicorn || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; } echo "[+] Got unicornafl." echo "[*] making sure config.h matches" |