[patch 0/5] futex: More robustness tweaks

From: Thomas Gleixner
Date: Wed Jun 11 2014 - 16:46:48 EST


While looking for the minimal functional fix for the futex CVE, I
found a few things which can be done simpler and therefor make the
code more robust.

1) UNLOCK_PI

Change the ordering:

- Lookup waiters first. If waiters exist wake up the top priority
waiter with all sanity checks applied. That allows us to catch
manipulation of the user space value.

- Only if there are no waiters, do the atomic release

2) futex_lock_pi_atomic()

Its a maze of retry hoops and loops. Reduce it to simple and
userstandable states.

That requires to split out the lookup and validation functions from
lookup_pi_state(), but that turns out to be an overall win on
readabilty.

The overall cleanup results in less code and 488 bytes text size
reduction on x8664.

Thanks,

tglx
---
futex.c | 385 ++++++++++++++++++++++++++++------------------------------------
1 file changed, 171 insertions(+), 214 deletions(-)

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