From bf253a3d3fa11b1a2b11c310bebc7bfa918ec64f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 5 Dec 2014 10:06:06 +0000 Subject: [PATCH] tsan: protect trace memory range on startup so that user does not map something there ahead of us llvm-svn: 223456 --- compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc index 46b648c..4612741 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc @@ -324,6 +324,9 @@ static void CheckAndProtect() { ProtectRange(kLoAppMemEnd, kShadowBeg); ProtectRange(kShadowEnd, kMetaShadowBeg); ProtectRange(kMetaShadowEnd, kTraceMemBeg); + // Memory for traces is mapped lazily in MapThreadTrace. + // Protect the whole range for now, so that user does not map something here. + ProtectRange(kTraceMemBeg, kTraceMemEnd); ProtectRange(kTraceMemEnd, kHeapMemBeg); ProtectRange(kHeapMemEnd + PrimaryAllocator::AdditionalSize(), kHiAppMemBeg); } -- 2.7.4