[compiler-rt] r346030 - [PowerPC]Disable randomized address space on Linux ppc64le

Lei Huang via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 12:00:24 PDT 2018


Author: lei
Date: Fri Nov  2 12:00:23 2018
New Revision: 346030

URL: http://llvm.org/viewvc/llvm-project?rev=346030&view=rev
Log:
[PowerPC]Disable randomized address space on Linux ppc64le

Recent versions of Ubuntu (17.04 and 18.04) on PowerPC have introduced changes
to Address Space Layout Randomization (ASLR) that is causing 500+ sanitizer
failures. This patch disables ASLR when running the sanitizers on PowerPC 64bit
LE.

Differential Revision: https://reviews.llvm.org/D52900

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=346030&r1=346029&r2=346030&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Fri Nov  2 12:00:23 2018
@@ -2010,6 +2010,17 @@ void CheckASLR() {
     Printf("This sanitizer is not compatible with enabled ASLR\n");
     Die();
   }
+#elif SANITIZER_PPC64V2
+  // Disable ASLR for Linux PPC64LE.
+  int old_personality = personality(0xffffffff);
+  if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0) {
+    VReport(1, "WARNING: Program is being run with address space layout "
+               "randomization (ASLR) enabled which prevents the thread and "
+               "memory sanitizers from working on powerpc64le.\n"
+               "ASLR will be disabled and the program re-executed.\n");
+    CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
+    ReExec();
+  }
 #else
   // Do nothing
 #endif




More information about the llvm-commits mailing list