futex/pi: Plug private futex exec() race
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
futex/pi: Plug private futex exec() race
The check for private futexes whether the waiter's mm, which is stored in the futex_key and copied into the pi_state, is the same as the owner's mm is not sufficient for exec(). exec() has a gap where the mm check fails to give the correct answer:
exec() ... exec_release_mm() futex_exec_release() tsk::futex::exit_state = EXITING; cleanup_robust_list(); 1) tsk::futex::exit_state = OK; ... old_mm = tsk::mm; 2) tsk::mm = ->mm;
Between #1 and #2 the check for the mm is wrong as that mm is about to be swapped out and eventually freed.
Plug this gap by:
1) Setting tsk::futex::exit_state to FUTEX_STATE_DEAD in futex_exec_release()
2) Setting tsk::futex::exit_state to FUTEX_STATE_OK after the mm has been switched.
From the CVE record · Linux
A race during exec() can cause the Linux kernel's private futex ownership check to use an mm that is about to be replaced and freed. This can give an incorrect result when a task using a private futex calls exec(); the input does not specify authentication requirements or further impact.
Engineers running the Linux kernel should check whether their kernel includes the futex/pi fix; affected versions are not specified.