[PATCH] D46466: [asan] Add AsanThread::Restart() to support thread restart

Walter Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 08:55:50 PDT 2018


waltl updated this revision to Diff 145475.
waltl added a comment.

Address CR comments.


Repository:
  rL LLVM

https://reviews.llvm.org/D46466

Files:
  compiler-rt/lib/asan/asan_thread.cc
  compiler-rt/lib/asan/asan_thread.h


Index: compiler-rt/lib/asan/asan_thread.h
===================================================================
--- compiler-rt/lib/asan/asan_thread.h
+++ compiler-rt/lib/asan/asan_thread.h
@@ -103,6 +103,8 @@
     t->Destroy(tid);
   }
 
+  void Restart();
+
   void StartSwitchFiber(FakeStack **fake_stack_save, uptr bottom, uptr size);
   void FinishSwitchFiber(FakeStack *fake_stack_save, uptr *bottom_old,
                          uptr *size_old);
Index: compiler-rt/lib/asan/asan_thread.cc
===================================================================
--- compiler-rt/lib/asan/asan_thread.cc
+++ compiler-rt/lib/asan/asan_thread.cc
@@ -115,6 +115,14 @@
   DTLS_Destroy();
 }
 
+void AsanThread::Restart() {
+  // Thread restart is a feature on RTEMS, where a thread may resume
+  // execution at an arbitrary function entry point, withbut its stack
+  // and TLS state reset.  This function handles the associated
+  // bookkeeping.
+  PoisonShadow(stack_bottom_, stack_top_ - stack_bottom_, 0);
+}
+
 void AsanThread::StartSwitchFiber(FakeStack **fake_stack_save, uptr bottom,
                                   uptr size) {
   if (atomic_load(&stack_switching_, memory_order_relaxed)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46466.145475.patch
Type: text/x-patch
Size: 1200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/f2521567/attachment.bin>


More information about the llvm-commits mailing list