lkml.org 
[lkml]   [2014]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[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(-)



\
 
 \ /
  Last update: 2014-06-11 23:21    [W:0.163 / U:5.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site