diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-07-08 13:36:59 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-07-08 13:36:59 +0000 |
commit | 6e23467162423e7be4f2e8cc9fdb966d256877fb (patch) | |
tree | 50badc468cd93adfcb5d4e9bba5cdb26aea722a9 | |
parent | a1d2b483b9468c644f3895974ef578e2d20703c8 (diff) | |
download | compiler-rt-6e23467162423e7be4f2e8cc9fdb966d256877fb.tar.gz |
tsan: fix a potential hang
idx0 is not updated in the branch,
so if we take that branch idx0 will stay updated forever
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212532 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/tsan/rtl/tsan_sync.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/tsan/rtl/tsan_sync.cc b/lib/tsan/rtl/tsan_sync.cc index 3952b2f67..3462b04c2 100644 --- a/lib/tsan/rtl/tsan_sync.cc +++ b/lib/tsan/rtl/tsan_sync.cc @@ -133,7 +133,7 @@ SyncVar* MetaMap::GetAndLock(ThreadState *thr, uptr pc, u32 myidx = 0; SyncVar *mys = 0; for (;;) { - u32 idx = *meta; + u32 idx = idx0; for (;;) { if (idx == 0) break; @@ -156,8 +156,10 @@ SyncVar* MetaMap::GetAndLock(ThreadState *thr, uptr pc, } if (!create) return 0; - if (*meta != idx0) + if (*meta != idx0) { + idx0 = *meta; continue; + } if (myidx == 0) { const u64 uid = atomic_fetch_add(&uid_gen_, 1, memory_order_relaxed); |