diff options
-rw-r--r-- | libdislocator/libdislocator.so.c | 2 | ||||
-rw-r--r-- | llvm_mode/Makefile | 4 | ||||
-rw-r--r-- | qemu_mode/README.md | 3 | ||||
-rw-r--r-- | qemu_mode/patches/afl-qemu-common.h | 2 | ||||
-rw-r--r-- | qemu_mode/patches/afl-qemu-tcg-inl.h | 20 |
5 files changed, 23 insertions, 8 deletions
diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index 10ea0a61..33985ce9 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 __thread 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 diff --git a/llvm_mode/Makefile b/llvm_mode/Makefile index 2548416e..f1b7cb23 100644 --- a/llvm_mode/Makefile +++ b/llvm_mode/Makefile @@ -36,7 +36,7 @@ else endif LLVMVER = $(shell $(LLVM_CONFIG) --version 2>/dev/null ) -LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^[12]|^3\.0|^1[0-9]' && echo 1 || echo 0 ) +LLVM_UNSUPPORTED = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^3\.[0-7]|^1[1-9]' && echo 1 || echo 0 ) LLVM_NEW_API = $(shell $(LLVM_CONFIG) --version 2>/dev/null | egrep -q '^1[0-9]' && echo 1 || echo 0 ) LLVM_MAJOR = $(shell $(LLVM_CONFIG) --version 2>/dev/null | sed 's/\..*//') LLVM_BINDIR = $(shell $(LLVM_CONFIG) --bindir 2>/dev/null) @@ -171,7 +171,7 @@ test_shm: endif no_build: - @printf "%b\\n" "\\033[0;31mPrerequisites are not met, skipping build\\033[0m" + @printf "%b\\n" "\\033[0;31mPrerequisites are not met, skipping build llvm_mode\\033[0m" test_deps: ifndef AFL_TRACE_PC diff --git a/qemu_mode/README.md b/qemu_mode/README.md index 87027f63..60d6c060 100644 --- a/qemu_mode/README.md +++ b/qemu_mode/README.md @@ -55,6 +55,9 @@ Note: if you want the QEMU helper to be installed on your system for all users, you need to build it before issuing 'make install' in the parent directory. +If you want to specify a different path for libraries (e.g. to run an arm64 +binary on x86_64) use QEMU_LD_PREFIX. + ## 3) Bonus feature #1: deferred initialization As for LLVM mode (refer to its README for mode details) QEMU mode supports diff --git a/qemu_mode/patches/afl-qemu-common.h b/qemu_mode/patches/afl-qemu-common.h index d4024353..2c1939aa 100644 --- a/qemu_mode/patches/afl-qemu-common.h +++ b/qemu_mode/patches/afl-qemu-common.h @@ -80,7 +80,7 @@ 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_i64 arg1, TCGv_i64 arg2); + 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 e3de09d8..33e0d2a7 100644 --- a/qemu_mode/patches/afl-qemu-tcg-inl.h +++ b/qemu_mode/patches/afl-qemu-tcg-inl.h @@ -42,10 +42,15 @@ void tcg_gen_afl_maybe_log_call(target_ulong cur_loc) { unsigned sizemask, flags; TCGOp * op; +#if TARGET_LONG_BITS == 64 TCGTemp *arg = tcgv_i64_temp(tcg_const_tl(cur_loc)); + sizemask = dh_sizemask(void, 0) | dh_sizemask(i64, 1); +#else + TCGTemp *arg = tcgv_i32_temp(tcg_const_tl(cur_loc)); + sizemask = dh_sizemask(void, 0) | dh_sizemask(i32, 1); +#endif flags = 0; - sizemask = dh_sizemask(void, 0) | dh_sizemask(i64, 1); #if defined(__sparc__) && !defined(__arch64__) && \ !defined(CONFIG_TCG_INTERPRETER) @@ -372,19 +377,26 @@ void tcg_gen_afl_call0(void *func) { } void tcg_gen_afl_compcov_log_call(void *func, target_ulong cur_loc, - TCGv_i64 arg1, TCGv_i64 arg2) { + TCGv arg1, TCGv arg2) { int i, real_args, nb_rets, pi; unsigned sizemask, flags; TCGOp * op; const int nargs = 3; +#if TARGET_LONG_BITS == 64 TCGTemp *args[3] = {tcgv_i64_temp(tcg_const_tl(cur_loc)), tcgv_i64_temp(arg1), tcgv_i64_temp(arg2)}; - - flags = 0; sizemask = dh_sizemask(void, 0) | dh_sizemask(i64, 1) | dh_sizemask(i64, 2) | dh_sizemask(i64, 3); +#else + TCGTemp *args[3] = {tcgv_i32_temp(tcg_const_tl(cur_loc)), tcgv_i32_temp(arg1), + tcgv_i32_temp(arg2)}; + sizemask = dh_sizemask(void, 0) | dh_sizemask(i32, 1) | dh_sizemask(i32, 2) | + dh_sizemask(i32, 3); +#endif + + flags = 0; #if defined(__sparc__) && !defined(__arch64__) && \ !defined(CONFIG_TCG_INTERPRETER) |