]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
futex: Fix pi_state->owner serialization
authorPeter Zijlstra <peterz@infradead.org>
Fri, 22 Sep 2017 15:48:06 +0000 (17:48 +0200)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 12 Oct 2017 21:20:48 +0000 (16:20 -0500)
commit01dcbf88b0f5730e27026ca1ea1a677ef81bd0b1
tree1e10017ecc4840605e0cb5780990adece0d3c50a
parentc43cbee0ebe7e9e888bca1ed4eb8fb20d962f930
futex: Fix pi_state->owner serialization

BugLink: http://bugs.launchpad.net/bugs/1721777
commit c74aef2d06a9f59cece89093eecc552933cba72a upstream.

There was a reported suspicion about a race between exit_pi_state_list()
and put_pi_state(). The same report mentioned the comment with
put_pi_state() said it should be called with hb->lock held, and it no
longer is in all places.

As it turns out, the pi_state->owner serialization is indeed broken. As per
the new rules:

  734009e96d19 ("futex: Change locking rules")

pi_state->owner should be serialized by pi_state->pi_mutex.wait_lock.
For the sites setting pi_state->owner we already hold wait_lock (where
required) but exit_pi_state_list() and put_pi_state() were not and
raced on clearing it.

Fixes: 734009e96d19 ("futex: Change locking rules")
Reported-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: dvhart@infradead.org
Link: https://lkml.kernel.org/r/20170922154806.jd3ffltfk24m4o4y@hirez.programming.kicks-ass.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
kernel/futex.c