[patch 2/4] futex-pi: Enforce waiter bit when owner died is detected

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Enforce the waiter bit to be set, when the previous owner has died. This
simplifies the glibc handling of the possible race from userspace tasks
which try to get hold of the lock and cleanup the mess which was leftover
by the unexpectedly died previous owner.

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>

 kernel/futex.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.17-rc1-mm3/kernel/futex.c
===================================================================
--- linux-2.6.17-rc1-mm3.orig/kernel/futex.c
+++ linux-2.6.17-rc1-mm3/kernel/futex.c
@@ -1161,11 +1161,16 @@ static int futex_lock_pi(u32 __user *uad
 		 * failed. When the OWNER_DIED bit is set, then we
 		 * know that this is a robust futex and we actually
 		 * take the lock. This is safe as we are protected by
-		 * the hash bucket lock.
+		 * the hash bucket lock. We also set the waiters bit
+		 * unconditionally here, to simplify glibc handling of
+		 * multiple tasks racing to acquire the lock and
+		 * cleanup the problems which were left by the dead
+		 * owner.
 		 */
 		if (curval & FUTEX_OWNER_DIED) {
 			uval = newval;
-			newval = current->pid | FUTEX_OWNER_DIED;
+			newval = current->pid |
+				FUTEX_OWNER_DIED | FUTEX_WAITERS;
 
 			inc_preempt_count();
 			curval = futex_atomic_cmpxchg_inatomic(uaddr,

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux