]> 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>
Wed, 7 Sep 2011 12:43:35 +0000 (14:43 +0200)
(cherry picked from commit 523df511514331a7fa0668b37a917b52f71684af)

nptl/ChangeLog
nptl/allocatestack.c

index 7411ae5e6fe318750a9b3cd40e226d5c9e001309..c4ae3cb38b027445df100b5f98319bd540dbe62d 100644 (file)
@@ -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
index 82408f5178f5654be06e15679d055c99b9fbf998..d4364bf218b4caf02c6e8be696b7e5f8588c6618 100644 (file)
@@ -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));