projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a480d30
)
tsan: fix a potential hang
author
Dmitry Vyukov
<dvyukov@google.com>
Tue, 8 Jul 2014 13:36:59 +0000
(13:36 +0000)
committer
Dmitry Vyukov
<dvyukov@google.com>
Tue, 8 Jul 2014 13:36:59 +0000
(13:36 +0000)
idx0 is not updated in the branch,
so if we take that branch idx0 will stay updated forever
llvm-svn: 212532
compiler-rt/lib/tsan/rtl/tsan_sync.cc
patch
|
blob
|
history
diff --git
a/compiler-rt/lib/tsan/rtl/tsan_sync.cc
b/compiler-rt/lib/tsan/rtl/tsan_sync.cc
index
3952b2f
..
3462b04
100644
(file)
--- a/
compiler-rt/lib/tsan/rtl/tsan_sync.cc
+++ b/
compiler-rt/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);