Skip to content
Snippets Groups Projects
Commit 72cddf33 authored by Dmitry Vyukov's avatar Dmitry Vyukov
Browse files

tsan: more robust current thread stack restoration

llvm-svn: 163089
parent c6fd8209
No related branches found
No related tags found
No related merge requests found
...@@ -399,6 +399,11 @@ void ReportRace(ThreadState *thr) { ...@@ -399,6 +399,11 @@ void ReportRace(ThreadState *thr) {
Shadow s(thr->racy_state[i]); Shadow s(thr->racy_state[i]);
RestoreStack(s.tid(), s.epoch(), &traces[i]); RestoreStack(s.tid(), s.epoch(), &traces[i]);
} }
// Failure to restore stack of the current thread
// was observed on free() interceptor called from pthread.
// Just get the current shadow stack instead.
if (traces[0].IsEmpty())
traces[0].ObtainCurrent(thr, 0);
if (HandleRacyStacks(thr, traces, addr_min, addr_max)) if (HandleRacyStacks(thr, traces, addr_min, addr_max))
return; return;
...@@ -408,9 +413,6 @@ void ReportRace(ThreadState *thr) { ...@@ -408,9 +413,6 @@ void ReportRace(ThreadState *thr) {
rep.AddMemoryAccess(addr, s, &traces[i]); rep.AddMemoryAccess(addr, s, &traces[i]);
} }
// Ensure that we have at least something for the current thread.
DCHECK_EQ(traces[0].IsEmpty(), false);
for (uptr i = 0; i < kMop; i++) { for (uptr i = 0; i < kMop; i++) {
FastState s(thr->racy_state[i]); FastState s(thr->racy_state[i]);
ThreadContext *tctx = ctx->threads[s.tid()]; ThreadContext *tctx = ctx->threads[s.tid()];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment