[compiler-rt] r276103 - tsan: fix leak of shadow stacks

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 03:29:09 PDT 2016


Author: dvyukov
Date: Wed Jul 20 05:29:08 2016
New Revision: 276103

URL: http://llvm.org/viewvc/llvm-project?rev=276103&view=rev
Log:
tsan: fix leak of shadow stacks


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc?rev=276103&r1=276102&r2=276103&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc Wed Jul 20 05:29:08 2016
@@ -125,6 +125,12 @@ void ThreadContext::OnStarted(void *arg)
 }
 
 void ThreadContext::OnFinished() {
+#ifdef SANITIZER_GO
+  internal_free(thr->shadow_stack);
+  thr->shadow_stack = nullptr;
+  thr->shadow_stack_pos = nullptr;
+  thr->shadow_stack_end = nullptr;
+#endif
   if (!detached) {
     thr->fast_state.IncrementEpoch();
     // Can't increment epoch w/o writing to the trace as well.




More information about the llvm-commits mailing list