tsan: disable ASLR in Go test on NetBSD
authorDmitry Vyukov <dvyukov@google.com>
Sat, 11 Apr 2020 07:46:45 +0000 (09:46 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Sat, 11 Apr 2020 07:46:45 +0000 (09:46 +0200)
Tsan does not support ASLR on NetBSD.
Disable ASLR in the Go test and extend
the error message to be more actionable.

Reported-by: Keith Randall (khr)
compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
compiler-rt/lib/tsan/go/buildgo.sh

index 15931e4..2168301 100644 (file)
@@ -2130,7 +2130,9 @@ void CheckASLR() {
   }
 
   if (UNLIKELY(paxflags & CTL_PROC_PAXFLAGS_ASLR)) {
-    Printf("This sanitizer is not compatible with enabled ASLR\n");
+    Printf("This sanitizer is not compatible with enabled ASLR.\n"
+           "To disable ASLR, please run \"paxctl +a %s\" and try again.\n",
+           GetArgv()[0]);
     Die();
   }
 #elif SANITIZER_PPC64V2
index 7cdb6f0..9e21b77 100755 (executable)
@@ -188,6 +188,10 @@ if [ "$DEPENDS_ON_LIBC" != "1" ]; then
        fi
 fi
 
+if [ "`uname -a | grep NetBSD`" != "" ]; then
+  # Turn off ASLR in the test binary.
+  /usr/sbin/paxctl +a $DIR/test
+fi
 export GORACE="exitcode=0 atexit_sleep_ms=0"
 if [ "$SILENT" != "1" ]; then
   $DIR/test