summaryrefslogtreecommitdiff
path: root/src/ldso/dynlink.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-10-06 23:57:51 -0400
committerRich Felker <dalias@aerifal.cx>2012-10-06 23:57:51 -0400
commit00902c7384963192dda8a15938786a36dca7d7ab (patch)
treedf0a684e3b60c93a66be0bd5648f076304cc386d /src/ldso/dynlink.c
parent92e1cd9b0ba9a8fa86e0346b121e159fb88f99bc (diff)
downloadmusl-00902c7384963192dda8a15938786a36dca7d7ab.tar.gz
musl-00902c7384963192dda8a15938786a36dca7d7ab.tar.bz2
musl-00902c7384963192dda8a15938786a36dca7d7ab.tar.xz
musl-00902c7384963192dda8a15938786a36dca7d7ab.zip
make new TLS setup block even implementation-internals signals
this is needed to ensure async-cancel-safety, i.e. to make it safe to access TLS objects when async cancellation is enabled. otherwise, if cancellation were acter upon after the atomic fetch/add but before the thread saved the obtained memory, another access to the same TLS in the cancellation handler could end up performing the atomic fetch/add again, consuming more memory than is actually available and overflowing into other objects on the heap.
Diffstat (limited to 'src/ldso/dynlink.c')
-rw-r--r--src/ldso/dynlink.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index e944c8e1..93cfb429 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -730,8 +730,7 @@ void *__tls_get_addr(size_t *v)
/* Block signals to make accessing new TLS async-signal-safe */
sigset_t set;
- sigfillset(&set);
- pthread_sigmask(SIG_BLOCK, &set, &set);
+ pthread_sigmask(SIG_BLOCK, SIGALL_SET, &set);
if (self->dtv && v[0]<=(size_t)self->dtv[0] && self->dtv[v[0]]) {
pthread_sigmask(SIG_SETMASK, &set, 0);
return (char *)self->dtv[v[0]]+v[1];