about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2021-02-18 19:39:46 +0100
committerhexcoder- <heiko@hexco.de>2021-02-18 19:39:46 +0100
commit1a713ff4205672bf1bb6f444e9e8ada39472471c (patch)
treed8252439515b951dc7c3937f84997c319afc3b94
parent5dd35f5281afec0955c08fe9f99e3c83222b7764 (diff)
downloadafl++-1a713ff4205672bf1bb6f444e9e8ada39472471c.tar.gz
fix qemu AFL_ENTRYPOINT for arm 32 and 64 bit
-rwxr-xr-xtest/test-qemu-mode.sh9
1 files changed, 1 insertions, 8 deletions
diff --git a/test/test-qemu-mode.sh b/test/test-qemu-mode.sh
index 0cd6ef40..85578d55 100755
--- a/test/test-qemu-mode.sh
+++ b/test/test-qemu-mode.sh
@@ -39,14 +39,7 @@ test -e ../afl-qemu-trace && {
       $ECHO "$GREY[*] running afl-fuzz for qemu_mode AFL_ENTRYPOINT, this will take approx 6 seconds"
       {
         {
-          if file test-instr | grep -q "32-bit"; then
-            # for 32-bit reduce 8 nibbles to the lower 7 nibbles
-	    ADDR_LOWER_PART=`nm test-instr | grep "T main" | awk '{print $1}' | sed 's/^.//'`
-          else
-            # for 64-bit reduce 16 nibbles to the lower 9 nibbles
-	    ADDR_LOWER_PART=`nm test-instr | grep "T main" | awk '{print $1}' | sed 's/^.......//'`
-          fi
-          export AFL_ENTRYPOINT=`expr 0x4${ADDR_LOWER_PART}`
+          export AFL_ENTRYPOINT=`printf 1 | AFL_DEBUG=1 ../afl-qemu-trace ./test-instr 2>&1 >/dev/null | awk '/forkserver/{print $4; exit}'`
           $ECHO AFL_ENTRYPOINT=$AFL_ENTRYPOINT - $(nm test-instr | grep "T main") - $(file ./test-instr)
           ../afl-fuzz -m ${MEM_LIMIT} -V2 -Q -i in -o out -- ./test-instr
           unset AFL_ENTRYPOINT