aboutsummaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authorBill Seurer <seurer@linux.vnet.ibm.com>2018-11-08 22:33:52 +0000
committerBill Seurer <seurer@gcc.gnu.org>2018-11-08 22:33:52 +0000
commit39abbb865c2363ab508bdf5dc24553e448c803b0 (patch)
tree80f82f107cf227c86d746379080ee917bcdf4c4f /libsanitizer
parentd69ac8b7f890f79560b11a3548fa39f3e7f8427e (diff)
downloadgcc-39abbb865c2363ab508bdf5dc24553e448c803b0.zip
gcc-39abbb865c2363ab508bdf5dc24553e448c803b0.tar.gz
gcc-39abbb865c2363ab508bdf5dc24553e448c803b0.tar.bz2
[PATCH, rs6000] Disable ASLR in sanitizer on powerpc64.
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. From-SVN: r265941
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog5
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_linux.cc11
2 files changed, 16 insertions, 0 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 6664c63..705e7ca 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -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
diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index 30d6521..244b5c3 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -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