about summary refs log tree commit diff
path: root/src/thread
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-10-14 21:10:44 -0400
committerRich Felker <dalias@aerifal.cx>2012-10-14 21:10:44 -0400
commit42c36f957d54926eec87b072a73439b9a1539347 (patch)
tree557ed9d643c3a0a82134ded51e002fdd86007d6c /src/thread
parentc62b9f39803221e250a490275f4cb23e9f737a6d (diff)
downloadmusl-42c36f957d54926eec87b072a73439b9a1539347.tar.gz
musl-42c36f957d54926eec87b072a73439b9a1539347.tar.xz
musl-42c36f957d54926eec87b072a73439b9a1539347.zip
fix overlap of thread stacks with thread tls segments
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/pthread_create.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c
index 6327a942..627ff5fb 100644
--- a/src/thread/pthread_create.c
+++ b/src/thread/pthread_create.c
@@ -130,7 +130,7 @@ int pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict attr,
 		}
 		tsd = map + size - __pthread_tsd_size;
 	}
-	new = __copy_tls(tsd - libc.tls_size);
+	new = __copy_tls(stack = tsd - libc.tls_size);
 	new->map_base = map;
 	new->map_size = size;
 	new->pid = self->pid;
@@ -145,7 +145,6 @@ int pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict attr,
 	}
 	new->unblock_cancel = self->cancel;
 	new->canary = self->canary;
-	stack = (void *)new;
 
 	a_inc(&libc.threads_minus_1);
 	ret = __clone(start, stack, flags, new, &new->tid, new, &new->tid);