futex: More robustness tweaks
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 11 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | futex: Make unlock_pi more robustkernel/ | +26 | 5 replies | |
| 2/5 | futex: Use futex_top_waiter() in lookup_pi_state()kernel/ | +63 | 1 reply | |
| 3/5 | futex: Split out the waiter check from lookup_pi_state()kernel/ | +71 | 1 reply | |
| 4/5 | futex: Split out the first waiter attachment from lookup_pi_state()kernel/ | +28 | 1 reply | |
| 5/5 | futex: Simplify futex_lock_pi_atomic() and make it more robustkernel/ | +53 | 7 replies |
Reviews trailers per patch
4 of 5 patches have a Reviewed-by or Acked-by.
| Patch | Darren Hart |
|---|---|
| 1/5 | R-b |
| 2/5 | R-b |
| 3/5 | R-b |
| 4/5 | R-b |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [patch 0/5] futex: More robustness tweaks
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(-)