aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-06-27 19:55:09 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2016-06-27 19:55:09 +0000
commit8b4bc947a74e8ca71490014a622ae0d8e4e72bcc (patch)
treecdfb72e1766e01bf69284694a1dd756ab5f22ffb /main/musl
parentb6179a9fb4d37ecfa4031c0fe9719485081e3522 (diff)
downloadaports-8b4bc947a74e8ca71490014a622ae0d8e4e72bcc.tar.bz2
aports-8b4bc947a74e8ca71490014a622ae0d8e4e72bcc.tar.xz
main/musl: fix pthread_exit code to match kernel behavior
https://github.com/dotnet/coreclr/issues/5872
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/APKBUILD6
-rw-r--r--main/musl/fix-failure-to-obtain-EOWNERDEAD-status-for-process-shared-robust-mutexes.patch69
2 files changed, 74 insertions, 1 deletions
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index 9dfde814f5..cd5fe80969 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.14
-pkgrel=10
+pkgrel=11
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -25,6 +25,7 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0011-fix-FILE-buffer-underflow-in-ungetwc.patch
0012-fix-incorrect-protocol-name-and-number-for-egp.patch
0001-check-result-from-res_mkquery.patch
+ fix-failure-to-obtain-EOWNERDEAD-status-for-process-shared-robust-mutexes.patch
ldconfig
__stack_chk_fail_local.c
@@ -145,6 +146,7 @@ a2457ce90f3e4d5ef04005b6f42e9bc3 0009-fix-regression-disabling-use-of-pause-ins
1a54c766a86a56946ee53f9515410670 0011-fix-FILE-buffer-underflow-in-ungetwc.patch
67ca785b787c53316397f96d21afab31 0012-fix-incorrect-protocol-name-and-number-for-egp.patch
3e78b4c125b0c3f06c06a9b4ade8e18d 0001-check-result-from-res_mkquery.patch
+34e04b179e4b4a1fdedd27cd27455271 fix-failure-to-obtain-EOWNERDEAD-status-for-process-shared-robust-mutexes.patch
830d01f7821b978df770b06db3790921 ldconfig
0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c
57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c
@@ -164,6 +166,7 @@ b937311664b96b6272e4e62e1aa0d44edd58c825cbb95746c82fab85a6390968 0008-fix-undef
b19de98d4c4051c2ff89b5f4b2705444f6f4c44a639692bedfa30a71b965fd04 0011-fix-FILE-buffer-underflow-in-ungetwc.patch
8721a088af8aa388c771174eb8e9b19cc96c47fe07d2fa8c70a640cdb7d52221 0012-fix-incorrect-protocol-name-and-number-for-egp.patch
7e5b08404da6f306ab8da9e81107a7901415d612069103d6f7b6b8e6ea504959 0001-check-result-from-res_mkquery.patch
+87e1b3398abf440b6757a61d40511714f8b97e1dfca09c406347842e885ff444 fix-failure-to-obtain-EOWNERDEAD-status-for-process-shared-robust-mutexes.patch
b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c
@@ -183,6 +186,7 @@ c0cf860bc7c6259dc626a1178258010e4ea6588f1ecd6c6c69ed85f11c5f0f6c502f59af3d9655bb
93a696ef060f4a7c9efe32589e3f8e0bb08cbbae6d0f9852aef8555f2f095f0d50431f55647ee8b59599916b0c90bb4aa251be495d3d2697b36c7cad5c9375a4 0011-fix-FILE-buffer-underflow-in-ungetwc.patch
78f1952b786cd4c31d956e169a6362d0f3007d68cb95308f88ae556dac88689cfa0e94856e5e8f727b1f27a9df5b35dab0fec8f3df4d925207c4980eb4e9f80f 0012-fix-incorrect-protocol-name-and-number-for-egp.patch
d1e393976546216a6de28b00a5b405a14d2cdf71945b695c3b45cd636f213ad037108f42301f21f213dbdac4dbce977813aea62cf9cee9f74432e1475e11ce22 0001-check-result-from-res_mkquery.patch
+b3d62e1dc83586c5babd68491dc6d0c8022b4bc234cdaf45726a0ebe35ce32ec85a39a69949bffa37110f0a4d8af8c9ecc5c1e9d76a0b131f20e6013a43feff3 fix-failure-to-obtain-EOWNERDEAD-status-for-process-shared-robust-mutexes.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c
diff --git a/main/musl/fix-failure-to-obtain-EOWNERDEAD-status-for-process-shared-robust-mutexes.patch b/main/musl/fix-failure-to-obtain-EOWNERDEAD-status-for-process-shared-robust-mutexes.patch
new file mode 100644
index 0000000000..445fa80455
--- /dev/null
+++ b/main/musl/fix-failure-to-obtain-EOWNERDEAD-status-for-process-shared-robust-mutexes.patch
@@ -0,0 +1,69 @@
+commit 384d103d94dba0472a587861f67d7ed6e8955f86
+Author: Rich Felker <dalias@aerifal.cx>
+Date: Mon Jun 27 15:18:13 2016 -0400
+
+ fix failure to obtain EOWNERDEAD status for process-shared robust mutexes
+
+ Linux's documentation (robust-futex-ABI.txt) claims that, when a
+ process dies with a futex on the robust list, bit 30 (0x40000000) is
+ set to indicate the status. however, what actually happens is that
+ bits 0-30 are replaced with the value 0x40000000, i.e. bits 0-29
+ (containing the old owner tid) are cleared at the same time bit 30 is
+ set.
+
+ our userspace-side code for robust mutexes was written based on that
+ documentation, assuming that kernel would never produce a futex value
+ of 0x40000000, since the low (owner) bits would always be non-zero.
+ commit d338b506e39b1e2c68366b12be90704c635602ce introduced this
+ assumption explicitly while fixing another bug in how non-recoverable
+ status for robust mutexes was tracked. presumably the tests conducted
+ at that time only checked non-process-shared robust mutexes, which are
+ handled in pthread_exit (which implemented the documented kernel
+ protocol, not the actual one) rather than by the kernel.
+
+ change pthread_exit robust list processing to match the kernel
+ behavior, clearing bits 0-29 while setting bit 30, and use the value
+ 0x7fffffff instead of 0x40000000 to encode non-recoverable status. the
+ choice of value here is arbitrary; any value with at least one of bits
+ 0-29 set should work just as well,
+
+diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
+index e7df34a..9f6b98e 100644
+--- a/src/thread/pthread_create.c
++++ b/src/thread/pthread_create.c
+@@ -79,7 +79,7 @@ _Noreturn void __pthread_exit(void *result)
+ int priv = (m->_m_type & 128) ^ 128;
+ self->robust_list.pending = rp;
+ self->robust_list.head = *rp;
+- int cont = a_swap(&m->_m_lock, self->tid|0x40000000);
++ int cont = a_swap(&m->_m_lock, 0x40000000);
+ self->robust_list.pending = 0;
+ if (cont < 0 || waiters)
+ __wake(&m->_m_lock, 1, priv);
+diff --git a/src/thread/pthread_mutex_trylock.c b/src/thread/pthread_mutex_trylock.c
+index 0df3ce2..54876a6 100644
+--- a/src/thread/pthread_mutex_trylock.c
++++ b/src/thread/pthread_mutex_trylock.c
+@@ -14,7 +14,7 @@ int __pthread_mutex_trylock_owner(pthread_mutex_t *m)
+ m->_m_count++;
+ return 0;
+ }
+- if (own == 0x40000000) return ENOTRECOVERABLE;
++ if (own == 0x7fffffff) return ENOTRECOVERABLE;
+
+ if (m->_m_type & 128) {
+ if (!self->robust_list.off) {
+diff --git a/src/thread/pthread_mutex_unlock.c b/src/thread/pthread_mutex_unlock.c
+index 02da92a..7dd00d2 100644
+--- a/src/thread/pthread_mutex_unlock.c
++++ b/src/thread/pthread_mutex_unlock.c
+@@ -24,7 +24,7 @@ int __pthread_mutex_unlock(pthread_mutex_t *m)
+ if (next != &self->robust_list.head) *(volatile void *volatile *)
+ ((char *)next - sizeof(void *)) = prev;
+ }
+- cont = a_swap(&m->_m_lock, (type & 8) ? 0x40000000 : 0);
++ cont = a_swap(&m->_m_lock, (type & 8) ? 0x7fffffff : 0);
+ if (type != PTHREAD_MUTEX_NORMAL && !priv) {
+ self->robust_list.pending = 0;
+ __vm_unlock();
+