diff options
author | Ulrich Drepper <drepper@redhat.com> | 2010-03-09 20:21:12 -0800 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2010-03-09 20:21:12 -0800 |
commit | 1d78f2996dc94c04578e83d1df221811fbe13fc7 (patch) | |
tree | 5c892d27f0be3ad2bd7f444bc95aa5091e5311cb /nptl/sysdeps | |
parent | 462a5227b0d3220ab68f65272bd5b9d6d4f49b1f (diff) | |
download | glibc-1d78f2996dc94c04578e83d1df221811fbe13fc7.tar glibc-1d78f2996dc94c04578e83d1df221811fbe13fc7.tar.gz glibc-1d78f2996dc94c04578e83d1df221811fbe13fc7.tar.bz2 glibc-1d78f2996dc94c04578e83d1df221811fbe13fc7.zip |
Fix a few more problem with the recent setxid changes.
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r-- | nptl/sysdeps/pthread/createthread.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c index 3bb3915281..8d96387a9a 100644 --- a/nptl/sysdeps/pthread/createthread.c +++ b/nptl/sysdeps/pthread/createthread.c @@ -75,19 +75,17 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr, int rc = ARCH_CLONE (fct, STACK_VARIABLES_ARGS, clone_flags, pd, &pd->tid, TLS_VALUE, &pd->tid); - /* Allow setxid from now onwards. */ - if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0) == -2, 0)) - lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE); - if (__builtin_expect (rc == -1, 0)) { atomic_decrement (&__nptl_nthreads); /* Oops, we lied for a second. */ - /* Failed. If the thread is detached, remove the TCB here since - the caller cannot do this. The caller remembered the thread - as detached and cannot reverify that it is not since it must - not access the thread descriptor again. */ - if (IS_DETACHED (pd)) + /* Perhaps a thread wants to change the IDs and if waiting + for this stillborn thread. */ + if (__builtin_expect (atomic_exchange_acq (&pd->setxid_futex, 0) + == -2, 0)) + lll_futex_wake (&pd->setxid_futex, 1, LLL_PRIVATE); + + /* Free the resources. */ __deallocate_stack (pd); /* We have to translate error codes. */ @@ -120,6 +118,9 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr, (void) INTERNAL_SYSCALL (tkill, err2, 2, pd->tid, SIGCANCEL); #endif + /* We do not free the stack here because the canceled thread + itself will do this. */ + return (INTERNAL_SYSCALL_ERROR_P (res, err) ? INTERNAL_SYSCALL_ERRNO (res, err) : 0); |