diff options
author | Kuba Mracek <mracek@apple.com> | 2017-02-02 13:17:05 +0000 |
---|---|---|
committer | Kuba Mracek <mracek@apple.com> | 2017-02-02 13:17:05 +0000 |
commit | dafbfeaa2a09e1fec8fa81304bfb80bb0b36763d (patch) | |
tree | 0292215bcb716dda18d7dd4b4302f346fd8d24bf /lib/tsan/rtl/tsan_sync.cc | |
parent | fcdea2a41c1be21e6b2601e0fda909bbc9628513 (diff) |
[tsan] Provide API for libraries for race detection on custom objects
This patch allows a non-instrumented library to call into TSan runtime, and tell us about "readonly" and "modifying" accesses to an arbitrary "object" and provide the caller and tag (type of object). This allows TSan to detect violations of API threading contracts where "read-only" methods can be called simulatenously from multiple threads, while modifying methods must be exclusive.
Differential Revision: https://reviews.llvm.org/D28836
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293885 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_sync.cc')
-rw-r--r-- | lib/tsan/rtl/tsan_sync.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/tsan/rtl/tsan_sync.cc b/lib/tsan/rtl/tsan_sync.cc index 44c6a26a1..2be047462 100644 --- a/lib/tsan/rtl/tsan_sync.cc +++ b/lib/tsan/rtl/tsan_sync.cc @@ -64,6 +64,7 @@ void MetaMap::AllocBlock(ThreadState *thr, uptr pc, uptr p, uptr sz) { u32 idx = block_alloc_.Alloc(&thr->proc()->block_cache); MBlock *b = block_alloc_.Map(idx); b->siz = sz; + b->tag = 0; b->tid = thr->tid; b->stk = CurrentStackId(thr, pc); u32 *meta = MemToMeta(p); |