about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2019-09-28 16:33:53 +0200
committerhexcoder- <heiko@hexco.de>2019-09-28 16:33:53 +0200
commit9c31196610307839085654273b36841af26d6cdd (patch)
treedde531944247dd7f8614a2ba449d1086435c84b4
parentca765b5ebb1ca59c30076cbe843d5382e65fd128 (diff)
downloadafl++-9c31196610307839085654273b36841af26d6cdd.tar.gz
check requirements before testing afl-fuzz (Linux and Mac OS X)
-rwxr-xr-xtest/test.sh21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/test.sh b/test/test.sh
index 716f7c27..ea69db8d 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -79,7 +79,16 @@ test -e ../${AFL_GCC} -a -e ../afl-showmap -a -e ../afl-fuzz && {
     rm -f test-instr.harden
   } || $ECHO "$RED[!] ${AFL_GCC} hardened mode compilation failed"
   # now we want to be sure that afl-fuzz is working  
-  {
+  # make sure core_pattern is set to core on linux
+  (test "$(uname -s)" = "Linux" && test "$(sysctl kernel.core_pattern)" != "kernel.core_pattern = core" && {
+    $ECHO "$RED[!] we cannot run afl-fuzz with enabled core dumps. Run 'sudo sh afl-system-config'.$RESET"
+    true
+  }) ||
+  # make sure crash reporter is disabled on Mac OS X
+  (test "$(uname -s)" = "Darwin" && test $(launchctl list 2>/dev/null | grep -q '\.ReportCrash$') && {
+    $ECHO "$RED[!] we cannot run afl-fuzz with enabled crash reporter. Run 'sudo sh afl-system-config'.$RESET"
+    true
+  }) || {
     mkdir -p in
     echo 0 > in/in
     $ECHO "$GREY[*] running afl-fuzz for ${AFL_GCC}, this will take approx 10 seconds"
@@ -116,7 +125,15 @@ test -e ../afl-clang-fast && {
     rm -f test-compcov.harden
   } || $ECHO "$RED[!] llvm_mode hardened mode compilation failed"
   # now we want to be sure that afl-fuzz is working  
-  {
+  (test "$(uname -s)" = "Linux" -a "$(sysctl kernel.core_pattern)" != "kernel.core_pattern = core" && {
+    $ECHO "$RED[!] we cannot run afl-fuzz with enabled core dumps. Run 'sudo sh afl-system-config'.$RESET"
+    true
+  }) ||
+  # make sure crash reporter is disabled on Mac OS X
+  (test "$(uname -s)" = "Darwin" -a $(launchctl list 2>/dev/null | grep -q '\.ReportCrash$') && {
+    $ECHO "$RED[!] we cannot run afl-fuzz with enabled crash reporter. Run 'sudo sh afl-system-config'.$RESET"
+    true
+  }) || {
     mkdir -p in
     echo 0 > in/in
     $ECHO "$GREY[*] running afl-fuzz for llvm_mode, this will take approx 10 seconds"