]> Git Repo - linux.git/commit - kernel/futex.c
futex: Make unlock_pi more robust
authorThomas Gleixner <[email protected]>
Wed, 11 Jun 2014 20:45:38 +0000 (20:45 +0000)
committerThomas Gleixner <[email protected]>
Sat, 21 Jun 2014 20:26:23 +0000 (22:26 +0200)
commitccf9e6a80d9e1b9df69c98e6b9745cf49869ee15
tree37da57e39262f0852466b62930dcbc005ce1800b
parent67792e2cabadbadd1a93f6790fa7bcbd47eca7c3
futex: Make unlock_pi more robust

The kernel tries to atomically unlock the futex without checking
whether there is kernel state associated to the futex.

So if user space manipulated the user space value, this will leave
kernel internal state around associated to the owner task.

For robustness sake, lookup first whether there are waiters on the
futex. If there are waiters, wake the top priority waiter with all the
proper sanity checks applied.

If there are no waiters, do the atomic release. We do not have to
preserve the waiters bit in this case, because a potentially incoming
waiter is blocked on the hb->lock and will acquire the futex
atomically. We neither have to preserve the owner died bit. The caller
is the owner and it was supposed to cleanup the mess.

Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Darren Hart <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
kernel/futex.c
This page took 0.058364 seconds and 4 git commands to generate.