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 #include #include +#include #include #include #include @@ -291,6 +292,14 @@ SetAddressSpaceUnlimited(); reexec = true; } + 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," + " which wouldn't work with ThreadSanitizer.\n"); + Report("Re-execing with fixed virtual address space.\n"); + CHECK(personality(old_personality | ADDR_NO_RANDOMIZE) != -1); + reexec = true; + } if (reexec) ReExec(); }