Skip to content

Commit

Permalink
Fix setxid race handling exiting threads
Browse files Browse the repository at this point in the history
(cherry picked from commit 523df51)
  • Loading branch information
Andreas Schwab committed Sep 7, 2011
1 parent 184d66c commit 69c1dfc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2011-08-31 Andreas Schwab <schwab@redhat.com>

* allocatestack.c (setxid_mark_thread): Ensure that the exiting
thread is woken up.

2011-08-08 Andreas Schwab <schwab@redhat.com>

* sysdeps/unix/sysv/linux/x86_64/cancellation.S: Maintain aligned
Expand Down
11 changes: 10 additions & 1 deletion nptl/allocatestack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 69c1dfc

Please sign in to comment.