]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH, rs6000] Disable ASLR in sanitizer on powerpc64.
authorseurer <seurer@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Nov 2018 22:33:52 +0000 (22:33 +0000)
committerseurer <seurer@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Nov 2018 22:33:52 +0000 (22:33 +0000)
Cherry pick powerpc64 sanitizer fix from upstream llvm.

See https://reviews.llvm.org/rL346030 and
https://reviews.llvm.org/D52900.

2018-11-08  Bill Seurer  <seurer@linux.vnet.ibm.com>

* libsanitizer/sanitizer_common/sanitizer_linux.cc (CheckASLR):
Disable ASLR for powerpc64 when using sanitizers.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265941 138bc75d-0d04-0410-961f-82ee72b054a4

libsanitizer/ChangeLog
libsanitizer/sanitizer_common/sanitizer_linux.cc

index 6664c63a4f7f01de5f1fc391ac79bd7aa0628989..705e7ca1c8ef8afcd915f9f9e5816f11cabd2449 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-08  Bill Seurer  <seurer@linux.vnet.ibm.com>
+
+       * libsanitizer/sanitizer_common/sanitizer_linux.cc (CheckASLR):
+       Disable ASLR for powerpc64 when using sanitizers.
+
 2018-11-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR sanitizer/80953
index 30d6521f9e90392a601b568b0478a050cb182f75..244b5c3ff833a9b4059c645296cb403fde691dae 100644 (file)
@@ -2008,6 +2008,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