about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2024-01-18 11:22:06 +0100
committervanhauser-thc <vh@thc.org>2024-01-18 11:22:06 +0100
commit523ce154c3cda758f234cadf76c73663b21e105f (patch)
tree827696e592d1b5ed1ba6647cf83eda1d4395ea26
parent04219f98575847e9846b4ecf0de40dd92cd9d56c (diff)
downloadafl++-523ce154c3cda758f234cadf76c73663b21e105f.tar.gz
disable aslr on apple
-rw-r--r--TODO.md3
-rwxr-xr-xafl-persistent-config8
-rw-r--r--src/afl-fuzz.c4
3 files changed, 12 insertions, 3 deletions
diff --git a/TODO.md b/TODO.md
index 50bd6d71..7cab71e8 100644
--- a/TODO.md
+++ b/TODO.md
@@ -9,9 +9,6 @@
  - afl-fuzz multicore wrapper script
  - when trimming then perform crash detection
  - either -L0 and/or -p mmopt results in zero new coverage
- - DYLD_NO_PIE=1
- - sudo nvram boot-args="no_aslr=1"
-
 
 
 ## Should
diff --git a/afl-persistent-config b/afl-persistent-config
index d78db286..26be9d9f 100755
--- a/afl-persistent-config
+++ b/afl-persistent-config
@@ -38,6 +38,7 @@ fi
 
 echo
 PLATFORM=`uname -s`
+ARCH=`uname -m`
 
 # check that we're on Mac
 if [[ "$PLATFORM" = "Darwin" ]] ; then
@@ -87,6 +88,13 @@ if [[ "$PLATFORM" = "Darwin" ]] ; then
 </plist>
 EOF
 
+  if [[ "$ARCH" = "x86_64" ]]; then
+    echo "Disabling ASLR system wide"
+    nvram boot-args="no_aslr=1"
+  else
+    echo NOTICE: on ARM64 we do not know currently how to disable system wide ASLR, please report if you know how.
+  fi
+
   echo
   echo "Reboot and enjoy your fuzzing"
   exit 0
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index 17949fd7..2d5787e8 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -1812,6 +1812,10 @@ int main(int argc, char **argv_orig, char **envp) {
   check_cpu_governor(afl);
   #endif
 
+  #ifdef __APPLE__
+  setenv("DYLD_NO_PIE", "1", 0);
+  #endif
+
   if (getenv("LD_PRELOAD")) {
 
     WARNF(