lkml.org 
[lkml]   [2016]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -v4 01/10] futex: Fix potential use-after-free in FUTEX_REQUEUE_PI
On Tue, Dec 13, 2016 at 09:36:39AM +0100, Peter Zijlstra wrote:
> While working on the futex code, I stumbled over this potential
> use-after-free scenario.
>
> pi_mutex is a pointer into pi_state, which we drop the reference on in
> unqueue_me_pi(). So any access to that pointer after that is bad.
>
> Since other sites already do rt_mutex_unlock() with hb->lock held, see
> for example futex_lock_pi(), simply move the unlock before
> unqueue_me_pi().

I believe this is unchanged from the previous version I reviewed. My only
comment would be possibly noting in the commit message that in addition to
EFAULT, ENOMEM and EHWPOISON from fixup_owner...fixup_user_fault() will now also
result in the unlock, we saw no reason to handle those cases differently, but in
case someone goes looking for the change, good to have it documented.

This passed my minimal testing (selftests/futex/functional in CI with kvm on a
dual socket Xeon "cpus=20,sockets=2,cores=5,threads=2").

Reviewed-by: Darren Hart <dvhart@linux.intel.com>

--
Darren Hart
Intel Open Source Technology Center

\
 
 \ /
  Last update: 2016-12-17 00:58    [W:0.206 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site