diff options
-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; } |