[compiler-rt] efeb35e - tsan: disable ASLR in Go test on NetBSD

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 11 01:30:53 PDT 2020


Author: Dmitry Vyukov
Date: 2020-04-11T09:46:45+02:00
New Revision: efeb35e19563df911febe6a53151103c3b6011a5

URL: https://github.com/llvm/llvm-project/commit/efeb35e19563df911febe6a53151103c3b6011a5
DIFF: https://github.com/llvm/llvm-project/commit/efeb35e19563df911febe6a53151103c3b6011a5.diff

LOG: tsan: disable ASLR in Go test on NetBSD

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)

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
    compiler-rt/lib/tsan/go/buildgo.sh

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 15931e4d1b4d..2168301fd69d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -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

diff  --git a/compiler-rt/lib/tsan/go/buildgo.sh b/compiler-rt/lib/tsan/go/buildgo.sh
index 7cdb6f0a7f7b..9e21b77d5a09 100755
--- a/compiler-rt/lib/tsan/go/buildgo.sh
+++ b/compiler-rt/lib/tsan/go/buildgo.sh
@@ -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


        


More information about the llvm-commits mailing list