diff options
author | Andreas Schwab <schwab@redhat.com> | 2010-06-25 10:41:17 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2010-07-02 11:17:24 +0200 |
commit | 5d073f18fd22a9fe7efe3c9ea92bc4ba7507ae1e (patch) | |
tree | c389260ae63e3bbc46a3225f0bafffa6c6abea00 | |
parent | 2f811bf88bed4a6c0dec8778847ba441736d509d (diff) | |
download | glibc-5d073f18fd22a9fe7efe3c9ea92bc4ba7507ae1e.tar.gz |
Fix setxid race handling exiting threads
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | nptl/allocatestack.c | 11 |
2 files changed, 13 insertions, 1 deletions
@@ -1,5 +1,8 @@ 2010-06-28 Andreas Schwab <schwab@redhat.com> + * allocatestack.c (setxid_mark_thread): Ensure that the exiting + thread is woken up. + * elf/Makefile: Add rules to build and run unload8 test. * elf/unload8.c: New file. * elf/unload8mod1.c: New file. diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 831e98e4ce..1ce9ed563d 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -994,7 +994,16 @@ setxid_mark_thread (struct xid_command *cmdp, struct pthread *t) /* If the thread is exiting right now, ignore it. */ if ((ch & EXITING_BITMASK) != 0) - return; + { + /* Release the futex if there is no other setxid in + progress. */ + if ((ch & SETXID_BITMASK) == 0) + { + t->setxid_futex = 1; + lll_futex_wake (&t->setxid_futex, 1, LLL_PRIVATE); + } + return; + } } while (atomic_compare_and_exchange_bool_acq (&t->cancelhandling, ch | SETXID_BITMASK, ch)); |