diff options
author | William Pitcock <nenolod@dereferenced.org> | 2017-08-01 22:40:56 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2017-08-01 22:40:56 +0000 |
commit | ce133a64851ee1338f287d21b6620d148b0c876b (patch) | |
tree | 94696a238354c302e67964d0ec3168cc3c50d91e | |
parent | 3f4c7d43f05de6a41dec049d75369b7d14711d7f (diff) | |
download | aports-ce133a64851ee1338f287d21b6620d148b0c876b.tar.bz2 aports-ce133a64851ee1338f287d21b6620d148b0c876b.tar.xz |
main/musl: do not attempt to join detached threads in pthread_join()
-rw-r--r-- | main/musl/2001-thread-do-not-attempt-to-join-detached-threads-in-pt.patch | 32 | ||||
-rw-r--r-- | main/musl/APKBUILD | 4 |
2 files changed, 35 insertions, 1 deletions
diff --git a/main/musl/2001-thread-do-not-attempt-to-join-detached-threads-in-pt.patch b/main/musl/2001-thread-do-not-attempt-to-join-detached-threads-in-pt.patch new file mode 100644 index 0000000000..4fc5c05095 --- /dev/null +++ b/main/musl/2001-thread-do-not-attempt-to-join-detached-threads-in-pt.patch @@ -0,0 +1,32 @@ +From 602a22f1b626f84e9f7117940c06f4890c584d2a Mon Sep 17 00:00:00 2001 +From: William Pitcock <nenolod@dereferenced.org> +Date: Tue, 1 Aug 2017 22:23:25 +0000 +Subject: [PATCH] thread: do not attempt to join detached threads in + pthread_join() + +A thread which is detached releases it's resources and TCB upon thread termination. +Therefore a thread which is detached is not joinable as any underlying futex will not +be incremented, resulting in a deadlock. Accordingly, we return EINVAL instead of +attempting to wait on a detached thread. + +Other pthread implementations such as glibc NPTL and FreeBSD also reject attempts +to join detached threads with EINVAL. +--- + src/thread/pthread_join.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/thread/pthread_join.c b/src/thread/pthread_join.c +index 52111489..7c4bde23 100644 +--- a/src/thread/pthread_join.c ++++ b/src/thread/pthread_join.c +@@ -11,6 +11,7 @@ int __pthread_timedjoin_np(pthread_t t, void **res, const struct timespec *at) + __pthread_testcancel(); + __pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); + if (cs == PTHREAD_CANCEL_ENABLE) __pthread_setcancelstate(cs, 0); ++ if (t->detached) r = EINVAL; + while ((tmp = t->tid) && r != ETIMEDOUT && r != EINVAL) + r = __timedwait_cp(&t->tid, tmp, CLOCK_REALTIME, at, 0); + __pthread_setcancelstate(cs, 0); +-- +2.13.2 + diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index 6d51712f2f..551614b1b8 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs <timo.teras@iki.fi> pkgname=musl pkgver=1.1.16 -pkgrel=15 +pkgrel=16 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -76,6 +76,7 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 0057-fix-missing-volatile-qualifier-on-lock-in-__get_loca.patch 1000-implement-strftime-GNU-extension-padding-specifiers-.patch 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch + 2001-thread-do-not-attempt-to-join-detached-threads-in-pt.patch ldconfig __stack_chk_fail_local.c @@ -258,6 +259,7 @@ dde4bb6c877d4fdf976e3ffea5d0a4a48f365708c488ceeaa4dcc29296820517aebbfa3b0527d74d 6e0a65d4023b4d2b0a971f1dbb5017fe7aedf7c663c0f9971841a4739758826c323cd0856a1591cfd874df35e8b96f1248eda029a9cd56987c36178a32b1f0ee 0057-fix-missing-volatile-qualifier-on-lock-in-__get_loca.patch 7e4c703e57a3564cd3ee1d5334b806cbe654355179ba55d4d25361dfc555eb4a7d081d80d64fdaff8476949afd04558d278b124d1fb108080beaa5ba2f8ce2b9 1000-implement-strftime-GNU-extension-padding-specifiers-.patch 2c8e1dde1834238097b2ee8a7bfb53471a0d9cff4a5e38b55f048b567deff1cdd47c170d0578a67b1a039f95a6c5fbb8cff369c75b6a3e4d7ed171e8e86ebb8c 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch +0771b1f9995ca3e687073c8c7562b6ddb395282f6f922556d6d06a37ea4e205479df550162908bd18706b6a2585239fc50cc5a00e9672af399c7376aff4efb3f 2001-thread-do-not-attempt-to-join-detached-threads-in-pt.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c |