<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/futex.c, branch v2.6.32</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.32</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.32'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2009-10-28T19:34:34Z</updated>
<entry>
<title>futex: Fix spurious wakeup for requeue_pi really</title>
<updated>2009-10-28T19:34:34Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2009-10-28T19:26:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=11df6dddcbc38affb7473aad3d962baf8414a947'/>
<id>urn:sha1:11df6dddcbc38affb7473aad3d962baf8414a947</id>
<content type='text'>
The requeue_pi path doesn't use unqueue_me() (and the racy lock_ptr ==
NULL test) nor does it use the wake_list of futex_wake() which where
the reason for commit 41890f2 (futex: Handle spurious wake up)

See debugging discussing on LKML Message-ID: &lt;4AD4080C.20703@us.ibm.com&gt;

The changes in this fix to the wait_requeue_pi path were considered to
be a likely unecessary, but harmless safety net. But it turns out that
due to the fact that for unknown $@#!*( reasons EWOULDBLOCK is defined
as EAGAIN we built an endless loop in the code path which returns
correctly EWOULDBLOCK.

Spurious wakeups in wait_requeue_pi code path are unlikely so we do
the easy solution and return EWOULDBLOCK^WEAGAIN to user space and let
it deal with the spurious wakeup.

Cc: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: John Stultz &lt;johnstul@linux.vnet.ibm.com&gt;
Cc: Dinakar Guniguntala &lt;dino@in.ibm.com&gt;
LKML-Reference: &lt;4AE23C74.1090502@us.ibm.com&gt;
Cc: stable@kernel.org
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;

</content>
</entry>
<entry>
<title>futex: Move drop_futex_key_refs out of spinlock'ed region</title>
<updated>2009-10-16T08:19:18Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhltc@us.ibm.com</email>
</author>
<published>2009-10-15T22:30:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=89061d3d58e1f0742139605dc6a7950aa1ecc019'/>
<id>urn:sha1:89061d3d58e1f0742139605dc6a7950aa1ecc019</id>
<content type='text'>
When requeuing tasks from one futex to another, the reference held
by the requeued task to the original futex location needs to be
dropped eventually.

Dropping the reference may ultimately lead to a call to
"iput_final" and subsequently call into filesystem- specific code -
which may be non-atomic.

It is therefore safer to defer this drop operation until after the
futex_hash_bucket spinlock has been dropped.

Originally-From: Helge Bahmann &lt;hcb@chaoticmind.net&gt;
Signed-off-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Cc: &lt;stable@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Dinakar Guniguntala &lt;dino@in.ibm.com&gt;
Cc: John Stultz &lt;johnstul@linux.vnet.ibm.com&gt;
Cc: Sven-Thorsten Dietrich &lt;sdietrich@novell.com&gt;
Cc: John Kacur &lt;jkacur@redhat.com&gt;
LKML-Reference: &lt;4AD7A298.5040802@us.ibm.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>futex: Check for NULL keys in match_futex</title>
<updated>2009-10-14T20:00:14Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhltc@us.ibm.com</email>
</author>
<published>2009-10-14T17:12:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2bc872036e1c5948b5b02942810bbdd8dbdb9812'/>
<id>urn:sha1:2bc872036e1c5948b5b02942810bbdd8dbdb9812</id>
<content type='text'>
If userspace tries to perform a requeue_pi on a non-requeue_pi waiter,
it will find the futex_q-&gt;requeue_pi_key to be NULL and OOPS.

Check for NULL in match_futex() instead of doing explicit NULL pointer
checks on all call sites.  While match_futex(NULL, NULL) returning
false is a little odd, it's still correct as we expect valid key
references.

Signed-off-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
CC: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
CC: Dinakar Guniguntala &lt;dino@in.ibm.com&gt;
CC: John Stultz &lt;johnstul@us.ibm.com&gt;
Cc: stable@kernel.org
LKML-Reference: &lt;4AD60687.10306@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>futex: Handle spurious wake up</title>
<updated>2009-10-13T18:40:43Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2009-10-13T18:40:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d58e6576b0deec6f0b9ff8450fe282da18c50883'/>
<id>urn:sha1:d58e6576b0deec6f0b9ff8450fe282da18c50883</id>
<content type='text'>
The futex code does not handle spurious wake up in futex_wait and
futex_wait_requeue_pi.

The code assumes that any wake up which was not caused by futex_wake /
requeue or by a timeout was caused by a signal wake up and returns one
of the syscall restart error codes.

In case of a spurious wake up the signal delivery code which deals
with the restart error codes is not invoked and we return that error
code to user space. That causes applications which actually check the
return codes to fail. Blaise reported that on preempt-rt a python test
program run into a exception trap. -rt exposed that due to a built in
spurious wake up accelerator :)

Solve this by checking signal_pending(current) in the wake up path and
handle the spurious wake up case w/o returning to user space.

Reported-by: Blaise Gassend &lt;blaise@willowgarage.com&gt;
Debugged-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: stable@kernel.org
LKML-Reference: &lt;new-submission&gt;
</content>
</entry>
<entry>
<title>Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip</title>
<updated>2009-10-08T19:16:35Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2009-10-08T19:16:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f579bbcd9bb8b688df03191b92c56ab8af4d6322'/>
<id>urn:sha1:f579bbcd9bb8b688df03191b92c56ab8af4d6322</id>
<content type='text'>
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  futex: fix requeue_pi key imbalance
  futex: Fix typo in FUTEX_WAIT/WAKE_BITSET_PRIVATE definitions
  rcu: Place root rcu_node structure in separate lockdep class
  rcu: Make hot-unplugged CPU relinquish its own RCU callbacks
  rcu: Move rcu_barrier() to rcutree
  futex: Move exit_pi_state() call to release_mm()
  futex: Nullify robust lists after cleanup
  futex: Fix locking imbalance
  panic: Fix panic message visibility by calling bust_spinlocks(0) before dying
  rcu: Replace the rcu_barrier enum with pointer to call_rcu*() function
  rcu: Clean up code based on review feedback from Josh Triplett, part 4
  rcu: Clean up code based on review feedback from Josh Triplett, part 3
  rcu: Fix rcu_lock_map build failure on CONFIG_PROVE_LOCKING=y
  rcu: Clean up code to address Ingo's checkpatch feedback
  rcu: Clean up code based on review feedback from Josh Triplett, part 2
  rcu: Clean up code based on review feedback from Josh Triplett
</content>
</entry>
<entry>
<title>futex: fix requeue_pi key imbalance</title>
<updated>2009-10-07T19:22:03Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhltc@us.ibm.com</email>
</author>
<published>2009-10-07T18:46:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=da085681014fb43d67d9bf6d14bc068e9254bd49'/>
<id>urn:sha1:da085681014fb43d67d9bf6d14bc068e9254bd49</id>
<content type='text'>
If futex_wait_requeue_pi() wakes prior to requeue, we drop the
reference to the source futex_key twice, once in
handle_early_requeue_pi_wakeup() and once on our way out.

Remove the drop from the handle_early_requeue_pi_wakeup() and keep
the get/drops together in futex_wait_requeue_pi().

Reported-by: Helge Bahmann &lt;hcb@chaoticmind.net&gt;
Signed-off-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Cc: Helge Bahmann &lt;hcb@chaoticmind.net&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Dinakar Guniguntala &lt;dino@in.ibm.com&gt;
Cc: John Stultz &lt;johnstul@us.ibm.com&gt;
Cc: stable-2.6.31 &lt;stable@kernel.org&gt;
LKML-Reference: &lt;4ACCE21E.5030805@us.ibm.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>futex: Fix locking imbalance</title>
<updated>2009-10-05T19:08:14Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2009-10-04T07:34:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=eaaea8036d0261d87d7072c5bc88c7ea730c18ac'/>
<id>urn:sha1:eaaea8036d0261d87d7072c5bc88c7ea730c18ac</id>
<content type='text'>
Rich reported a lock imbalance in the futex code:

   http://bugzilla.kernel.org/show_bug.cgi?id=14288

It's caused by the displacement of the retry_private label in
futex_wake_op(). The code unlocks the hash bucket locks in the
error handling path and retries without locking them again which
makes the next unlock fail.

Move retry_private so we lock the hash bucket locks when we retry.

Reported-by: Rich Ercolany &lt;rercola@acm.jhu.edu&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Cc: stable-2.6.31 &lt;stable@kernel.org&gt;
LKML-Reference: &lt;new-submission&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>futex: Add memory barrier commentary to futex_wait_queue_me()</title>
<updated>2009-09-24T20:30:10Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhltc@us.ibm.com</email>
</author>
<published>2009-09-24T18:54:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9beba3c54dd180a26a1da2027cfbe9edfaf9c40e'/>
<id>urn:sha1:9beba3c54dd180a26a1da2027cfbe9edfaf9c40e</id>
<content type='text'>
The memory barrier semantics of futex_wait_queue_me() are
non-obvious. Add some commentary to try and clarify it.

Signed-off-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Dinakar Guniguntala &lt;dino@in.ibm.com&gt;
Cc: John Stultz &lt;johnstul@us.ibm.com&gt;
LKML-Reference: &lt;20090924185447.694.38948.stgit@Aeon&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>futex: Fix wakeup race by setting TASK_INTERRUPTIBLE before queue_me()</title>
<updated>2009-09-22T08:37:44Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhltc@us.ibm.com</email>
</author>
<published>2009-09-22T05:30:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0729e196147692d84d4c099fcff056eba2ed61d8'/>
<id>urn:sha1:0729e196147692d84d4c099fcff056eba2ed61d8</id>
<content type='text'>
PI futexes do not use the same plist_node_empty() test for wakeup.
It was possible for the waiter (in futex_wait_requeue_pi()) to set
TASK_INTERRUPTIBLE after the waker assigned the rtmutex to the
waiter. The waiter would then note the plist was not empty and call
schedule(). The task would not be found by any subsequeuent futex
wakeups, resulting in a userspace hang.

By moving the setting of TASK_INTERRUPTIBLE to before the call to
queue_me(), the race with the waker is eliminated. Since we no
longer call get_user() from within queue_me(), there is no need to
delay the setting of TASK_INTERRUPTIBLE until after the call to
queue_me().

The FUTEX_LOCK_PI operation is not affected as futex_lock_pi()
relies entirely on the rtmutex code to handle schedule() and
wakeup.  The requeue PI code is affected because the waiter starts
as a non-PI waiter and is woken on a PI futex.

Remove the crusty old comment about holding spinlocks() across
get_user() as we no longer do that. Correct the locking statement
with a description of why the test is performed.

Signed-off-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Acked-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Dinakar Guniguntala &lt;dino@in.ibm.com&gt;
Cc: John Stultz &lt;johnstul@us.ibm.com&gt;
LKML-Reference: &lt;20090922053038.8717.97838.stgit@Aeon&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>futex: Correct futex_q woken state commentary</title>
<updated>2009-09-22T08:37:44Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhltc@us.ibm.com</email>
</author>
<published>2009-09-22T05:30:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d8d88fbb186fe3ea37b2a58adb32413c98b59656'/>
<id>urn:sha1:d8d88fbb186fe3ea37b2a58adb32413c98b59656</id>
<content type='text'>
Use kernel-doc format to describe struct futex_q.

Correct the wakeup definition to eliminate the statement about
waking the waiter between the plist_del() and the q-&gt;lock_ptr = 0.

Note in the comment that PI futexes have a different definition of
the woken state.

Signed-off-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Acked-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: Dinakar Guniguntala &lt;dino@in.ibm.com&gt;
Cc: John Stultz &lt;johnstul@us.ibm.com&gt;
LKML-Reference: &lt;20090922053029.8717.62798.stgit@Aeon&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
</feed>
