[PATCH] D18003: [tsan] Disable randomized address space on linux aarch64.

Yabin Cui via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 11:46:12 PDT 2016


yabinc added inline comments.

================
Comment at: lib/tsan/rtl/tsan_platform_linux.cc:297
@@ +296,3 @@
+    int old_personality = personality(0xffffffff);
+    if (old_personality != -1 && (old_personality & ADDR_NO_RANDOMIZE) == 0) {
+      Report("WARNING: Program is run with randomized virtual address space,"
----------------
`Thanks for explanation of kHeapMem, that makes much sense. And now I believe it is wrong to compare ModuleEnd() with HeapEnd().
For COMPAT mode, I run following commands with this patch enabled on x86_64:
$./thread_sanitize 
old_personality = 0, ADDR_NO_RANDOMIZE = 40000
==16085==WARNING: Program is run with randomized virtual address space, and uses mmap base out of that assumed by ThreadSanitizer.
==16085==Re-execing with fixed virtual address space.
old_personality = 40000, ADDR_NO_RANDOMIZE = 40000

$setarch i686 -L ./thread_sanitize
old_personality = 200008, ADDR_NO_RANDOMIZE = 40000
==16186==WARNING: Program is run with randomized virtual address space, and uses mmap base out of that assumed by ThreadSanitizer.
==16186==Re-execing with fixed virtual address space.
old_personality = 240008, ADDR_NO_RANDOMIZE = 40000
FATAL: ThreadSanitizer: unexpected memory mapping 0x2aaaaaaab000-0x2aaaaaace000

So it won't cause infinite loop. Because personality() takes effect accross execv(), so the code won't try to set it again if it has been set before. But I think it is fine to limit this patch to aarch64 if other architectures don't need this.`


http://reviews.llvm.org/D18003





More information about the llvm-commits mailing list