From 523df511514331a7fa0668b37a917b52f71684af Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 25 Jun 2010 10:41:17 +0200 Subject: Fix setxid race handling exiting threads --- nptl/allocatestack.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'nptl/allocatestack.c') diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 9b8b0ceb40..23d2ce559c 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)); -- cgit v1.2.3