[PATCH] D52900: [PowerPC]Disable randomized address space on Linux ppc64le

Lei Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 12:02:00 PDT 2018


lei created this revision.
lei added reviewers: echristo, hfinkel, seurer, kcc, dvyukov.
Herald added subscribers: Sanitizers, llvm-commits, jsji, nemanjai, kubamracek.

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.

We are continuing to investigate a long-term solution that will allow the sanitizers to run with ASLR enabled. However, in the meantime this will allow the sanitizers to function correctly on these systems.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D52900

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_linux.cc


Index: compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
+++ compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
@@ -1994,6 +1994,16 @@
     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 run with randomized virtual address "
+              "space, which wouldn't work with linux ppc64le sanitizer.\n"
+              "Re-execing with fixed virtual address space.\n");
+    CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
+    ReExec();
+  }
 #else
   // Do nothing
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52900.168343.patch
Type: text/x-patch
Size: 877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181004/b053a8a7/attachment.bin>


More information about the llvm-commits mailing list