diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2012-08-18 11:49:00 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2012-08-18 11:49:00 +0000 |
commit | 55e711ed818d7553d62eba4b3a2fad3e2723f697 (patch) | |
tree | 198ecf28db95c10bab243415975b3f4fc6e1ac07 /lib | |
parent | a911c6f1d0c6f8b7e175bd36e7044d79cdcf5153 (diff) | |
download | compiler-rt-55e711ed818d7553d62eba4b3a2fad3e2723f697.tar.gz |
tsan: proper handling of linker initialized mutexes
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@162169 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tsan/rtl/tsan_rtl_mutex.cc | 32 | ||||
-rw-r--r-- | lib/tsan/rtl/tsan_sync.cc | 4 |
2 files changed, 19 insertions, 17 deletions
diff --git a/lib/tsan/rtl/tsan_rtl_mutex.cc b/lib/tsan/rtl/tsan_rtl_mutex.cc index 0f8104313..41cbbad01 100644 --- a/lib/tsan/rtl/tsan_rtl_mutex.cc +++ b/lib/tsan/rtl/tsan_rtl_mutex.cc @@ -42,23 +42,21 @@ void MutexDestroy(ThreadState *thr, uptr pc, uptr addr) { SyncVar *s = ctx->synctab.GetAndRemove(thr, pc, addr); if (s == 0) return; - if (!s->is_linker_init) { - MemoryWrite1Byte(thr, pc, addr); - if (flags()->report_destroy_locked - && s->owner_tid != SyncVar::kInvalidTid - && !s->is_broken) { - s->is_broken = true; - ScopedReport rep(ReportTypeMutexDestroyLocked); - rep.AddMutex(s); - StackTrace trace; - trace.ObtainCurrent(thr, pc); - rep.AddStack(&trace); - FastState last(s->last_lock); - RestoreStack(last.tid(), last.epoch(), &trace); - rep.AddStack(&trace); - rep.AddLocation(s->addr, 1); - OutputReport(rep); - } + MemoryWrite1Byte(thr, pc, addr); + if (flags()->report_destroy_locked + && s->owner_tid != SyncVar::kInvalidTid + && !s->is_broken) { + s->is_broken = true; + ScopedReport rep(ReportTypeMutexDestroyLocked); + rep.AddMutex(s); + StackTrace trace; + trace.ObtainCurrent(thr, pc); + rep.AddStack(&trace); + FastState last(s->last_lock); + RestoreStack(last.tid(), last.epoch(), &trace); + rep.AddStack(&trace); + rep.AddLocation(s->addr, 1); + OutputReport(rep); } DestroyAndFree(s); } diff --git a/lib/tsan/rtl/tsan_sync.cc b/lib/tsan/rtl/tsan_sync.cc index 1f798b297..86265bb81 100644 --- a/lib/tsan/rtl/tsan_sync.cc +++ b/lib/tsan/rtl/tsan_sync.cc @@ -123,6 +123,8 @@ SyncVar* SyncTab::GetAndRemove(ThreadState *thr, uptr pc, uptr addr) { res = *prev; while (res) { if (res->addr == addr) { + if (res->is_linker_init) + return 0; *prev = res->next; break; } @@ -147,6 +149,8 @@ SyncVar* SyncTab::GetAndRemove(ThreadState *thr, uptr pc, uptr addr) { res = *prev; while (res) { if (res->addr == addr) { + if (res->is_linker_init) + return 0; *prev = res->next; break; } |