]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix setxid race handling exiting threads
authorAndreas Schwab <schwab@redhat.com>
Fri, 25 Jun 2010 08:41:17 +0000 (10:41 +0200)
committerAndreas Schwab <schwab@redhat.com>
Fri, 2 Jul 2010 09:17:24 +0000 (11:17 +0200)
ChangeLog
nptl/allocatestack.c

index a072719c7d52a67bd49e1aafade88d82ce3aef22..04b40d1e8fffbea111b9f646fd84bde063096c6a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 831e98e4ce8ee608fbd08b26bb2162fcfc4a7229..1ce9ed563d6089597a419b9dba286da7800a234e 100644 (file)
@@ -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));