Index: lib/tsan/rtl/tsan_rtl_thread.cc =================================================================== --- lib/tsan/rtl/tsan_rtl_thread.cc +++ lib/tsan/rtl/tsan_rtl_thread.cc @@ -276,10 +276,14 @@ void ThreadFinish(ThreadState *thr) { ThreadCheckIgnore(thr); StatInc(thr, StatThreadFinish); - if (thr->stk_addr && thr->stk_size) + if (thr->stk_addr && thr->stk_size) { + MemoryResetRange(thr, /*pc=*/ 1, thr->stk_addr, thr->stk_size); DontNeedShadowFor(thr->stk_addr, thr->stk_size); - if (thr->tls_addr && thr->tls_size) + } + if (thr->tls_addr && thr->tls_size) { + MemoryResetRange(thr, /*pc=*/ 1, thr->tls_addr, thr->tls_size); DontNeedShadowFor(thr->tls_addr, thr->tls_size); + } thr->is_dead = true; ctx->thread_registry->FinishThread(thr->tid); }