Message ID | f931d369-8bd1-da3c-d6ab-a8779d337b7e@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
Series | [rs6000] Disable ASLR in sanitizer on powerpc64. | expand |
On 11/8/18 12:12 PM, Bill Seurer wrote: > [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. > > Bootstrapped and tested on powerpc64le-unknown-linux-gnu and > powerpc64-unknown-linux-gnu with no regressions. Is this ok for trunk? > > > 2018-11-08 Bill Seurer <seurer@linux.vnet.ibm.com> > > * libsanitizer/sanitizer_common/sanitizer_linux.cc (CheckASLR): > Disable ASLR for powerpc64 when using sanitizers. Cheery-picked from upstream should always be OK for the sanitizer runtime. jeff
Index: libsanitizer/sanitizer_common/sanitizer_linux.cc =================================================================== --- libsanitizer/sanitizer_common/sanitizer_linux.cc (revision 265876) +++ libsanitizer/sanitizer_common/sanitizer_linux.cc (working copy) @@ -2008,6 +2008,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