[PATCH] D18526: [tsan] Disable randomized address space on Android aarch64.
Yabin Cui via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 29 11:11:02 PDT 2016
yabinc updated this revision to Diff 51957.
yabinc added a comment.
Replace Report() with VReport(), and enable the patch on aarch64.
http://reviews.llvm.org/D18526
Files:
lib/tsan/rtl/tsan_platform_linux.cc
Index: lib/tsan/rtl/tsan_platform_linux.cc
===================================================================
--- lib/tsan/rtl/tsan_platform_linux.cc
+++ lib/tsan/rtl/tsan_platform_linux.cc
@@ -36,6 +36,7 @@
#include <string.h>
#include <stdarg.h>
#include <sys/mman.h>
+#include <sys/personality.h>
#include <sys/syscall.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -291,6 +292,20 @@
SetAddressSpaceUnlimited();
reexec = true;
}
+#if defined(__aarch64__)
+ // 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.
+ 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 "
+ "space, which wouldn't work with ThreadSanitizer.\n"
+ "Re-execing with fixed virtual address space.\n");
+ CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
+ reexec = true;
+ }
+#endif
if (reexec)
ReExec();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18526.51957.patch
Type: text/x-patch
Size: 1296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160329/8d02cb3a/attachment.bin>
More information about the llvm-commits
mailing list