summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2016-05-17 22:24:55 +0000
committerAnna Zaks <ganna@apple.com>2016-05-17 22:24:55 +0000
commit41a8ddbff8f8092409bbbaa753d5ac508c98ee13 (patch)
treea8cb8968f2c6b531e3ad03b935c820b2dc56ca66 /lib
parentfcc603851ff180536f71bae303d3c024c66c7595 (diff)
[tsan] Ensure mmap respects ignore_interceptors_accesses
The ignore_interceptors_accesses setting did not have an effect on mmap, so let's change that. It helps in cases user code is accessing the memory written to by mmap when the synchronization is ensured by the code that does not get rebuilt. (This effects Swift interoperability since it's runtime is mapping memory which gets accessed by the code emitted into the Swift application by the compiler.) Differential Revision: http://reviews.llvm.org/D20294 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/tsan/rtl/tsan_interceptors.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/tsan/rtl/tsan_interceptors.cc b/lib/tsan/rtl/tsan_interceptors.cc
index ba182a6fa..e43032ec1 100644
--- a/lib/tsan/rtl/tsan_interceptors.cc
+++ b/lib/tsan/rtl/tsan_interceptors.cc
@@ -711,7 +711,11 @@ TSAN_INTERCEPTOR(void *, mmap, void *addr, SIZE_T sz, int prot, int flags,
if (res != MAP_FAILED) {
if (fd > 0)
FdAccess(thr, pc, fd);
- MemoryRangeImitateWrite(thr, pc, (uptr)res, sz);
+
+ if (thr->ignore_reads_and_writes == 0)
+ MemoryRangeImitateWrite(thr, pc, (uptr)res, sz);
+ else
+ MemoryResetRange(thr, pc, (uptr)res, sz);
}
return res;
}
@@ -726,7 +730,11 @@ TSAN_INTERCEPTOR(void *, mmap64, void *addr, SIZE_T sz, int prot, int flags,
if (res != MAP_FAILED) {
if (fd > 0)
FdAccess(thr, pc, fd);
- MemoryRangeImitateWrite(thr, pc, (uptr)res, sz);
+
+ if (thr->ignore_reads_and_writes == 0)
+ MemoryRangeImitateWrite(thr, pc, (uptr)res, sz);
+ else
+ MemoryResetRange(thr, pc, (uptr)res, sz);
}
return res;
}