[compiler-rt] 3c73c56 - [tsan] re-exec when ASLR is enabled for x86_64 as well

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 11:38:45 PST 2022


Author: zijunzhao
Date: 2022-12-08T19:38:21Z
New Revision: 3c73c560e4dbbcec55372620a3b69d32bbf5e0c0

URL: https://github.com/llvm/llvm-project/commit/3c73c560e4dbbcec55372620a3b69d32bbf5e0c0
DIFF: https://github.com/llvm/llvm-project/commit/3c73c560e4dbbcec55372620a3b69d32bbf5e0c0.diff

LOG: [tsan] re-exec when ASLR is enabled for x86_64 as well

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D136897

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
index 526018a06c0e..9094469ba4eb 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
@@ -298,11 +298,12 @@ void InitializePlatform() {
       SetAddressSpaceUnlimited();
       reexec = true;
     }
-#if SANITIZER_LINUX && defined(__aarch64__)
+#if SANITIZER_ANDROID && (defined(__aarch64__) || defined(__x86_64__))
     // After patch "arm64: mm: support ARCH_MMAP_RND_BITS." is introduced in
     // linux kernel, the random gap between stack and mapped area is increased
     // from 128M to 36G on 39-bit aarch64. As it is almost impossible to cover
     // this big range, we should disable randomized virtual space on aarch64.
+    // ASLR personality check.
     int old_personality = personality(0xffffffff);
     if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0) {
       VReport(1, "WARNING: Program is run with randomized virtual address "
@@ -311,6 +312,9 @@ void InitializePlatform() {
       CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
       reexec = true;
     }
+
+#endif
+#if SANITIZER_LINUX && defined(__aarch64__)
     // Initialize the xor key used in {sig}{set,long}jump.
     InitializeLongjmpXorKey();
 #endif


        


More information about the llvm-commits mailing list