X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fthread%2Fpthread_create.c;h=ecf93a46617116fb6f7313e888256f16c1b1fde3;hp=87bf8166ff85242ad890e0832cdc07c3399b7972;hb=9372655e884b3829c6639fc1a6047b2569f3c3ec;hpb=afc35d5efde48b82a7786d9c89b115965da6b637 diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c index 87bf8166..ecf93a46 100644 --- a/src/thread/pthread_create.c +++ b/src/thread/pthread_create.c @@ -43,19 +43,16 @@ void pthread_exit(void *result) __syscall(SYS_exit, 0); } -void __do_cleanup_push(struct __ptcb *cb, void (*f)(void *), void *x) +void __do_cleanup_push(struct __ptcb *cb) { struct pthread *self = pthread_self(); - cb->__f = f; - cb->__x = x; cb->__next = self->cancelbuf; self->cancelbuf = cb; } -void __do_cleanup_pop(struct __ptcb *cb, int run) +void __do_cleanup_pop(struct __ptcb *cb) { __pthread_self()->cancelbuf = cb->__next; - if (run) cb->__f(cb->__x); } static int start(void *p) @@ -107,7 +104,7 @@ int pthread_create(pthread_t *res, const pthread_attr_t *attr, void *(*entry)(vo size = guard + ROUND(attr->_a_stacksize + DEFAULT_STACK_SIZE); } size += __pthread_tsd_size; - map = mmap(0, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0); + map = mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); if (map == MAP_FAILED) return EAGAIN; if (guard) mprotect(map, guard, PROT_NONE); @@ -123,6 +120,7 @@ int pthread_create(pthread_t *res, const pthread_attr_t *attr, void *(*entry)(vo new->tsd = (void *)tsd; if (attr) new->detached = attr->_a_detach; new->unblock_cancel = self->cancel; + new->canary = self->canary ^ (uintptr_t)&new; stack = (void *)new; __synccall_lock();