aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2022-10-19 10:41:40 +0200
committervanhauser-thc <vh@thc.org>2022-10-19 10:41:40 +0200
commit5ccf38941472bda9415d14edc4ecefaa43c79d67 (patch)
treedc2772fbc4cd79d389a8c05604b8278c2b8edff2 /test
parent96ee3fb8995c27fedd30c2b9c92238268c80acba (diff)
downloadafl++-5ccf38941472bda9415d14edc4ecefaa43c79d67.tar.gz
nits
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-qemu-mode.sh23
1 files changed, 15 insertions, 8 deletions
diff --git a/test/test-qemu-mode.sh b/test/test-qemu-mode.sh
index 46b138ff..c7734217 100755
--- a/test/test-qemu-mode.sh
+++ b/test/test-qemu-mode.sh
@@ -107,14 +107,21 @@ test -e ../afl-qemu-trace && {
test "$SYS" = "i686" -o "$SYS" = "x86_64" -o "$SYS" = "amd64" -o "$SYS" = "i86pc" -o "$SYS" = "aarch64" -o ! "${SYS%%arm*}" && {
$ECHO "$GREY[*] running afl-fuzz for persistent qemu_mode, this will take approx 10 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_QEMU_PERSISTENT_ADDR=`expr 0x4${ADDR_LOWER_PART}`
+ IS_STATIC=""
+ file test-instr | grep -q 'statically linked' && IS_STATIC=1
+ test -z "$IS_STATIC" && {
+ 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_QEMU_PERSISTENT_ADDR=`expr 0x4${ADDR_LOWER_PART}`
+ }
+ test -n "$IS_STATIC" && {
+ export AFL_QEMU_PERSISTENT_ADDR=0x`nm test-instr | grep "T main" | awk '{print $1}'`
+ }
export AFL_QEMU_PERSISTENT_GPR=1
$ECHO "Info: AFL_QEMU_PERSISTENT_ADDR=$AFL_QEMU_PERSISTENT_ADDR <= $(nm test-instr | grep "T main" | awk '{print $1}')"
env|grep AFL_|sort