[compiler-rt] r341594 - [hwasan] fix pthread_exit

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 6 15:13:44 PDT 2018


Author: kcc
Date: Thu Sep  6 15:13:43 2018
New Revision: 341594

URL: http://llvm.org/viewvc/llvm-project?rev=341594&view=rev
Log:
[hwasan] fix pthread_exit

Added:
    compiler-rt/trunk/test/hwasan/TestCases/pthread_exit.c
Modified:
    compiler-rt/trunk/lib/hwasan/hwasan_thread.cc

Modified: compiler-rt/trunk/lib/hwasan/hwasan_thread.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/hwasan/hwasan_thread.cc?rev=341594&r1=341593&r2=341594&view=diff
==============================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_thread.cc (original)
+++ compiler-rt/trunk/lib/hwasan/hwasan_thread.cc Thu Sep  6 15:13:43 2018
@@ -44,7 +44,7 @@ void Thread::InsertIntoThreadList(Thread
 }
 
 void Thread::RemoveFromThreadList(Thread *t) {
-  CHECK_NE(t, main_thread);
+  if (t == main_thread) return;  // Do nothing (happens due to pthread_exit).
   SpinMutexLock l(&thread_list_mutex);
   thread_stats.n_live_threads--;
   thread_stats.total_stack_size -= t->stack_size();

Added: compiler-rt/trunk/test/hwasan/TestCases/pthread_exit.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/pthread_exit.c?rev=341594&view=auto
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/pthread_exit.c (added)
+++ compiler-rt/trunk/test/hwasan/TestCases/pthread_exit.c Thu Sep  6 15:13:43 2018
@@ -0,0 +1,5 @@
+// Tests pthread_exit.
+// RUN: %clang_hwasan %s -o %t && %run %t
+// REQUIRES: stable-runtime
+#include <pthread.h>
+int main() { pthread_exit(NULL); }




More information about the llvm-commits mailing list