diff options
author | Lei Huang <lei@ca.ibm.com> | 2018-11-02 19:00:23 +0000 |
---|---|---|
committer | Lei Huang <lei@ca.ibm.com> | 2018-11-02 19:00:23 +0000 |
commit | 78f7a6eaa601bfdd6ae70ffd3da2254c21ff77f9 (patch) | |
tree | 27ac9ade763ca1ba02029e195cd7b5d41baa98af /compiler-rt/lib/sanitizer_common | |
parent | 5b023e07eafe1c358b02b2ae0bf88bcaadceaf60 (diff) | |
download | bcm5719-llvm-78f7a6eaa601bfdd6ae70ffd3da2254c21ff77f9.tar.gz bcm5719-llvm-78f7a6eaa601bfdd6ae70ffd3da2254c21ff77f9.zip |
[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
llvm-svn: 346030
Diffstat (limited to 'compiler-rt/lib/sanitizer_common')
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index 68eed1a2850..49040e4def3 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -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 |