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

Lei Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 11:59:22 PDT 2018


lei updated this revision to Diff 168850.
lei added a comment.

Warning message updated.


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
@@ -2013,6 +2013,17 @@
     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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52900.168850.patch
Type: text/x-patch
Size: 953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181009/f5804e14/attachment-0001.bin>


More information about the llvm-commits mailing list