pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

compiler-rt-netbsd: Upgrade to SVN r. 319004



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sun Nov 26 21:30:48 2017 +0100
Changeset:	2150b32d653dcf0468a1ead36411cbd54f0c8129

Modified Files:
	compiler-rt-netbsd/Makefile
	compiler-rt-netbsd/distinfo
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
Removed Files:
	compiler-rt-netbsd/patches/patch-lib_lsan_lsan__interceptors.cc
	compiler-rt-netbsd/patches/patch-lib_lsan_lsan__thread.cc
	compiler-rt-netbsd/patches/patch-lib_lsan_lsan__thread.h
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
	compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.h
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.h
	compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__thread.cc

Log Message:
compiler-rt-netbsd: Upgrade to SVN r. 319004

This revision contains upstreamed patch for Thread Joined/Exited race.

Prevent Thread Exited/Joined events race
https://reviews.llvm.org/D40457

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=2150b32d653dcf0468a1ead36411cbd54f0c8129

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 compiler-rt-netbsd/Makefile                        |  2 +-
 compiler-rt-netbsd/distinfo                        |  9 +---
 .../patches/patch-lib_lsan_lsan__interceptors.cc   | 17 --------
 .../patches/patch-lib_lsan_lsan__thread.cc         | 13 ------
 .../patches/patch-lib_lsan_lsan__thread.h          | 13 ------
 ...anitizer__common_sanitizer__thread__registry.cc | 50 ----------------------
 ...sanitizer__common_sanitizer__thread__registry.h | 35 ---------------
 .../patch-lib_tsan_rtl_tsan__interceptors.cc       | 38 ----------------
 .../patches/patch-lib_tsan_rtl_tsan__rtl.h         | 13 ------
 .../patch-lib_tsan_rtl_tsan__rtl__thread.cc        | 18 --------
 10 files changed, 2 insertions(+), 206 deletions(-)

diffs:
diff --git a/compiler-rt-netbsd/Makefile b/compiler-rt-netbsd/Makefile
index d1aec79d79..a4e5ac3048 100644
--- a/compiler-rt-netbsd/Makefile
+++ b/compiler-rt-netbsd/Makefile
@@ -5,7 +5,7 @@ CATEGORIES=	lang devel
 
 SVN_REPOSITORIES=	compiler-rt
 SVN_REPO.compiler-rt=	http://llvm.org/svn/llvm-project/compiler-rt/trunk
-SVN_REVISION.compiler-rt=	318994
+SVN_REVISION.compiler-rt=	319004
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	http://compiler-rt.llvm.org/
diff --git a/compiler-rt-netbsd/distinfo b/compiler-rt-netbsd/distinfo
index e86bcfd056..5ca0c6973c 100644
--- a/compiler-rt-netbsd/distinfo
+++ b/compiler-rt-netbsd/distinfo
@@ -2,15 +2,8 @@ $NetBSD: distinfo,v 1.35 2015/09/11 01:21:57 tnn Exp $
 
 SHA1 (patch-cmake_config-ix.cmake) = 41e22425cade0674e8cc254fa474a418cd2a7fa0
 SHA1 (patch-lib_fuzzer_tests_CMakeLists.txt) = 38ca750154dfc9843a56748078235824b772a147
-SHA1 (patch-lib_lsan_lsan__interceptors.cc) = 996b0d8634bba7c3eca69c5eb175284e5f834e5c
-SHA1 (patch-lib_lsan_lsan__thread.cc) = 5cfc982f13ad8171fcd2859f2e37edef2f0e41b2
-SHA1 (patch-lib_lsan_lsan__thread.h) = 5fbcc7fe73e619d88912413d99af2f4878ffeae6
 SHA1 (patch-lib_msan_msan.h) = 1ee0f86ccb410561d381afba526c85aa5dace912
 SHA1 (patch-lib_sanitizer__common_sanitizer__signal__interceptors.inc) = e510af025a295a36799d15c8caf0b6bbb4272f48
-SHA1 (patch-lib_sanitizer__common_sanitizer__thread__registry.cc) = 2883ce1ceff9e55c064db944573b568e4b201571
-SHA1 (patch-lib_sanitizer__common_sanitizer__thread__registry.h) = 8b6ab550a34b4e8526a18e45ef6fc05af64e4c2a
-SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = f7c41bff3b94c14bdeb2e12a595e0fdaafbb6708
+SHA1 (patch-lib_tsan_rtl_tsan__interceptors.cc) = 4210a48686ca5159b4648e668e43b4ceec4c436d
 SHA1 (patch-lib_tsan_rtl_tsan__rtl.cc) = a2485075212f150ee2ce33616e887be2b3f41822
-SHA1 (patch-lib_tsan_rtl_tsan__rtl.h) = fbab7ceae96a0a2bf9ec7449dd29a8c0e1613943
 SHA1 (patch-lib_tsan_rtl_tsan__rtl__amd64.S) = 5a0bed4cf2c1f63affeed8886983a53b4376ab5b
-SHA1 (patch-lib_tsan_rtl_tsan__rtl__thread.cc) = 80538a9300eb81a1eec353c51fa420d6dcf012b2
diff --git a/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__interceptors.cc
deleted file mode 100644
index 6d39f7db2b..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__interceptors.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD$
-
---- lib/lsan/lsan_interceptors.cc.orig	2017-10-17 18:35:51.000000000 +0000
-+++ lib/lsan/lsan_interceptors.cc
-@@ -389,10 +389,10 @@ INTERCEPTOR(int, pthread_create, void *t
- 
- INTERCEPTOR(int, pthread_join, void *th, void **ret) {
-   ENSURE_LSAN_INITED;
--  int tid = ThreadTid((uptr)th);
-+  ThreadContextBase *tctx = ThreadTctx((uptr)th);
-   int res = REAL(pthread_join)(th, ret);
-   if (res == 0)
--    ThreadJoin(tid);
-+    ThreadJoin(tctx->tid);
-   return res;
- }
- 
diff --git a/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__thread.cc b/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__thread.cc
deleted file mode 100644
index 9bd2cb204d..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__thread.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- lib/lsan/lsan_thread.cc.orig	2017-10-17 18:35:51.000000000 +0000
-+++ lib/lsan/lsan_thread.cc
-@@ -111,7 +111,7 @@ static bool FindThreadByUid(ThreadContex
-   return false;
- }
- 
--u32 ThreadTid(uptr uid) {
-+ThreadContextBase *ThreadTctx(uptr uid) {
-   return thread_registry->FindThread(FindThreadByUid, (void*)uid);
- }
- 
diff --git a/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__thread.h b/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__thread.h
deleted file mode 100644
index 594e2aa677..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_lsan_lsan__thread.h
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- lib/lsan/lsan_thread.h.orig	2017-10-17 18:35:51.000000000 +0000
-+++ lib/lsan/lsan_thread.h
-@@ -49,7 +49,7 @@ void ThreadStart(u32 tid, tid_t os_id, b
- void ThreadFinish();
- u32 ThreadCreate(u32 tid, uptr uid, bool detached);
- void ThreadJoin(u32 tid);
--u32 ThreadTid(uptr uid);
-+ThreadContextBase *ThreadTctx(uptr uid);
- 
- u32 GetCurrentThread();
- void SetCurrentThread(u32 tid);
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
deleted file mode 100644
index 14ef1fcd78..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_thread_registry.cc.orig	2017-10-17 18:35:46.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_thread_registry.cc
-@@ -21,6 +21,7 @@ ThreadContextBase::ThreadContextBase(u32
-       status(ThreadStatusInvalid),
-       detached(false), workerthread(false), parent_tid(0), next(0) {
-   name[0] = '\0';
-+  atomic_store_relaxed(&thread_destroyed, 0);
- }
- 
- ThreadContextBase::~ThreadContextBase() {
-@@ -85,9 +86,18 @@ void ThreadContextBase::SetCreated(uptr 
- void ThreadContextBase::Reset() {
-   status = ThreadStatusInvalid;
-   SetName(0);
-+  atomic_store_relaxed(&thread_destroyed, 0);
-   OnReset();
- }
- 
-+void ThreadContextBase::SetDestroyed() {
-+  atomic_store(&thread_destroyed, 1, memory_order_release);
-+}
-+
-+bool ThreadContextBase::GetDestroyed() {
-+  return !!atomic_load(&thread_destroyed, memory_order_acquire);
-+}
-+
- // ThreadRegistry implementation.
- 
- const u32 ThreadRegistry::kUnknownTid = ~0U;
-@@ -170,14 +180,15 @@ void ThreadRegistry::RunCallbackForEachT
-   }
- }
- 
--u32 ThreadRegistry::FindThread(FindThreadCallback cb, void *arg) {
-+ThreadContextBase *
-+ThreadRegistry::FindThread(FindThreadCallback cb, void *arg) {
-   BlockingMutexLock l(&mtx_);
-   for (u32 tid = 0; tid < n_contexts_; tid++) {
-     ThreadContextBase *tctx = threads_[tid];
-     if (tctx != 0 && cb(tctx, arg))
--      return tctx->tid;
-+      return tctx;
-   }
--  return kUnknownTid;
-+  return 0;
- }
- 
- ThreadContextBase *
diff --git a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.h b/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.h
deleted file mode 100644
index 944291dad1..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__thread__registry.h
+++ /dev/null
@@ -1,35 +0,0 @@
-$NetBSD$
-
---- lib/sanitizer_common/sanitizer_thread_registry.h.orig	2017-10-17 18:35:46.000000000 +0000
-+++ lib/sanitizer_common/sanitizer_thread_registry.h
-@@ -50,6 +50,8 @@ class ThreadContextBase {
-   u32 parent_tid;
-   ThreadContextBase *next;  // For storing thread contexts in a list.
- 
-+  atomic_uint32_t thread_destroyed; // To address race of Joined vs Finished
-+
-   void SetName(const char *new_name);
- 
-   void SetDead();
-@@ -60,6 +62,9 @@ class ThreadContextBase {
-                   u32 _parent_tid, void *arg);
-   void Reset();
- 
-+  void SetDestroyed();
-+  bool GetDestroyed();
-+
-   // The following methods may be overriden by subclasses.
-   // Some of them take opaque arg that may be optionally be used
-   // by subclasses.
-@@ -102,9 +107,9 @@ class ThreadRegistry {
-   void RunCallbackForEachThreadLocked(ThreadCallback cb, void *arg);
- 
-   typedef bool (*FindThreadCallback)(ThreadContextBase *tctx, void *arg);
--  // Finds a thread using the provided callback. Returns kUnknownTid if no
-+  // Finds a thread using the provided callback. Returns NULL if no
-   // thread is found.
--  u32 FindThread(FindThreadCallback cb, void *arg);
-+  ThreadContextBase *FindThread(FindThreadCallback cb, void *arg);
-   // Should be guarded by ThreadRegistryLock. Return 0 if no thread
-   // is found.
-   ThreadContextBase *FindThreadContextLocked(FindThreadCallback cb,
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
index d6c0ce4604..33a83d1c99 100644
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
+++ b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__interceptors.cc
@@ -108,44 +108,6 @@ $NetBSD$
  
  #if !SANITIZER_MAC
  TSAN_INTERCEPTOR(void*, malloc, uptr size) {
-@@ -868,6 +933,7 @@ void DestroyThreadState() {
-   }
-   DTLS_Destroy();
-   cur_thread_finalize();
-+  thr->tctx->SetDestroyed();
- }
- }  // namespace __tsan
- 
-@@ -982,12 +1048,14 @@ TSAN_INTERCEPTOR(int, pthread_create,
- 
- TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) {
-   SCOPED_INTERCEPTOR_RAW(pthread_join, th, ret);
--  int tid = ThreadTid(thr, pc, (uptr)th);
-+  ThreadContextBase *tctx = ThreadTctx(thr, pc, (uptr)th);
-   ThreadIgnoreBegin(thr, pc);
-   int res = BLOCK_REAL(pthread_join)(th, ret);
-   ThreadIgnoreEnd(thr, pc);
-   if (res == 0) {
--    ThreadJoin(thr, pc, tid);
-+    while (!tctx->GetDestroyed())
-+       internal_sched_yield();
-+    ThreadJoin(thr, pc, tctx->tid);
-   }
-   return res;
- }
-@@ -996,10 +1064,10 @@ DEFINE_REAL_PTHREAD_FUNCTIONS
- 
- TSAN_INTERCEPTOR(int, pthread_detach, void *th) {
-   SCOPED_TSAN_INTERCEPTOR(pthread_detach, th);
--  int tid = ThreadTid(thr, pc, (uptr)th);
-+  ThreadContextBase *tctx = ThreadTctx(thr, pc, (uptr)th);
-   int res = REAL(pthread_detach)(th);
-   if (res == 0) {
--    ThreadDetach(thr, pc, tid);
-+    ThreadDetach(thr, pc, tctx->tid);
-   }
-   return res;
- }
 @@ -2332,7 +2400,7 @@ static __sanitizer_sighandler_ptr signal
    internal_memset(&act.sa_mask, -1, sizeof(act.sa_mask));
    act.sa_flags = 0;
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.h b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.h
deleted file mode 100644
index 9e8c44c61e..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl.h
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- lib/tsan/rtl/tsan_rtl.h.orig	2017-11-16 17:55:36.000000000 +0000
-+++ lib/tsan/rtl/tsan_rtl.h
-@@ -757,7 +757,7 @@ void FuncExit(ThreadState *thr);
- int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached);
- void ThreadStart(ThreadState *thr, int tid, tid_t os_id, bool workerthread);
- void ThreadFinish(ThreadState *thr);
--int ThreadTid(ThreadState *thr, uptr pc, uptr uid);
-+ThreadContextBase *ThreadTctx(ThreadState *thr, uptr pc, uptr uid);
- void ThreadJoin(ThreadState *thr, uptr pc, int tid);
- void ThreadDetach(ThreadState *thr, uptr pc, int tid);
- void ThreadFinalize(ThreadState *thr);
diff --git a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__thread.cc b/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__thread.cc
deleted file mode 100644
index 2e326a1bb4..0000000000
--- a/compiler-rt-netbsd/patches/patch-lib_tsan_rtl_tsan__rtl__thread.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD$
-
---- lib/tsan/rtl/tsan_rtl_thread.cc.orig	2017-10-17 18:35:43.000000000 +0000
-+++ lib/tsan/rtl/tsan_rtl_thread.cc
-@@ -293,9 +293,10 @@ static bool FindThreadByUid(ThreadContex
-   return false;
- }
- 
--int ThreadTid(ThreadState *thr, uptr pc, uptr uid) {
--  int res = ctx->thread_registry->FindThread(FindThreadByUid, (void*)uid);
--  DPrintf("#%d: ThreadTid uid=%zu tid=%d\n", thr->tid, uid, res);
-+ThreadContextBase *ThreadTctx(ThreadState *thr, uptr pc, uptr uid) {
-+  ThreadContextBase *res;
-+  res = ctx->thread_registry->FindThread(FindThreadByUid, (void*)uid);
-+  DPrintf("#%d: ThreadTid uid=%zu tid=%d\n", thr->tid, uid, res->tid);
-   return res;
- }
- 


Home | Main Index | Thread Index | Old Index