summaryrefslogtreecommitdiffstats
path: root/nptl/allocatestack.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2010-06-25 10:41:17 +0200
committerAndreas Schwab <schwab@redhat.com>2011-09-07 14:43:35 +0200
commit69c1dfc1a7964cc15d429350905aea821803a40c (patch)
tree7b9de4af1e620f924362bc1e277a95c7a20cd109 /nptl/allocatestack.c
parentrtld, i386: Fix cfi directive in audit trampoline code (diff)
downloadglibc-69c1dfc1a7964cc15d429350905aea821803a40c.tar.xz
glibc-69c1dfc1a7964cc15d429350905aea821803a40c.zip
Fix setxid race handling exiting threads
(cherry picked from commit 523df511514331a7fa0668b37a917b52f71684af)
Diffstat (limited to '')
-rw-r--r--nptl/allocatestack.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 82408f5178..d4364bf218 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -999,7 +999,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));