<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/futex.c, branch v2.6.37</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.37</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.37'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2010-11-10T12:27:50Z</updated>
<entry>
<title>futex: Address compiler warnings in exit_robust_list</title>
<updated>2010-11-10T12:27:50Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhart@linux.intel.com</email>
</author>
<published>2010-11-04T19:00:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4c115e951d80aff126468adaec7a6c7854f61ab8'/>
<id>urn:sha1:4c115e951d80aff126468adaec7a6c7854f61ab8</id>
<content type='text'>
Since commit 1dcc41bb (futex: Change 3rd arg of fetch_robust_entry()
to unsigned int*) some gcc versions decided to emit the following
warning:

kernel/futex.c: In function ‘exit_robust_list’:
kernel/futex.c:2492: warning: ‘next_pi’ may be used uninitialized in this function

The commit did not introduce the warning as gcc should have warned
before that commit as well. It's just gcc being silly.

The code path really can't result in next_pi being unitialized (or
should not), but let's keep the build clean. Annotate next_pi as an
uninitialized_var.

[ tglx: Addressed the same issue in futex_compat.c and massaged the
  	changelog ]

Signed-off-by: Darren Hart &lt;dvhart@linux.intel.com&gt;
Tested-by: Matt Fleming &lt;matt@console-pimps.org&gt;
Tested-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
LKML-Reference: &lt;1288897200-13008-1-git-send-email-dvhart@linux.intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>new helper: ihold()</title>
<updated>2010-10-26T01:26:11Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2010-10-23T15:11:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7de9c6ee3ecffd99e1628e81a5ea5468f7581a1f'/>
<id>urn:sha1:7de9c6ee3ecffd99e1628e81a5ea5468f7581a1f</id>
<content type='text'>
Clones an existing reference to inode; caller must already hold one.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Merge branch 'futexes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip</title>
<updated>2010-10-21T21:06:17Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-10-21T21:06:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b61f6a57f1919ef8dbd33f864df9b8b361c65b11'/>
<id>urn:sha1:b61f6a57f1919ef8dbd33f864df9b8b361c65b11</id>
<content type='text'>
* 'futexes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  futex: Fix kernel-doc notation &amp; typos
  futex: Add lock context annotations
  futex: Mark restart_block.futex.uaddr[2] __user
  futex: Change 3rd arg of fetch_robust_entry() to unsigned int*
</content>
</entry>
<entry>
<title>futex: Fix errors in nested key ref-counting</title>
<updated>2010-10-19T09:41:54Z</updated>
<author>
<name>Darren Hart</name>
<email>dvhart@linux.intel.com</email>
</author>
<published>2010-10-17T15:35:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7ada876a8703f23befbb20a7465a702ee39b1704'/>
<id>urn:sha1:7ada876a8703f23befbb20a7465a702ee39b1704</id>
<content type='text'>
futex_wait() is leaking key references due to futex_wait_setup()
acquiring an additional reference via the queue_lock() routine. The
nested key ref-counting has been masking bugs and complicating code
analysis. queue_lock() is only called with a previously ref-counted
key, so remove the additional ref-counting from the queue_(un)lock()
functions.

Also futex_wait_requeue_pi() drops one key reference too many in
unqueue_me_pi(). Remove the key reference handling from
unqueue_me_pi(). This was paired with a queue_lock() in
futex_lock_pi(), so the count remains unchanged.

Document remaining nested key ref-counting sites.

Signed-off-by: Darren Hart &lt;dvhart@linux.intel.com&gt;
Reported-and-tested-by: Matthieu Fertré&lt;matthieu.fertre@kerlabs.com&gt;
Reported-by: Louis Rilling&lt;louis.rilling@kerlabs.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
LKML-Reference: &lt;4CBB17A8.70401@linux.intel.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>futex: Fix kernel-doc notation &amp; typos</title>
<updated>2010-10-14T06:57:35Z</updated>
<author>
<name>Randy Dunlap</name>
<email>randy.dunlap@oracle.com</email>
</author>
<published>2010-10-13T18:02:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fb62db2ba943b1683f1d7181bb2988fce4c60870'/>
<id>urn:sha1:fb62db2ba943b1683f1d7181bb2988fce4c60870</id>
<content type='text'>
Convert futex_requeue() function parameters to use @name
kernel-doc notation and add @fshared &amp; @cmpval to prevent
kernel-doc warnings.

Add @list to struct futex_q.

Fix a few typos.

Signed-off-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Acked-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
LKML-Reference: &lt;20101013110234.89b06043.randy.dunlap@oracle.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>futex: Add lock context annotations</title>
<updated>2010-09-18T10:19:21Z</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@gmail.com</email>
</author>
<published>2010-09-14T12:43:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=15e408cd6ccc3f4f453d87ccd5bc7a84d59feb96'/>
<id>urn:sha1:15e408cd6ccc3f4f453d87ccd5bc7a84d59feb96</id>
<content type='text'>
queue_lock/unlock/me() and unqueue_me_pi() grab/release spinlocks
but are missing proper annotations. Add them.

Signed-off-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Darren Hart &lt;dvhltc@us.ibm.com&gt;
LKML-Reference: &lt;1284468228-8723-3-git-send-email-namhyung@gmail.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>futex: Mark restart_block.futex.uaddr[2] __user</title>
<updated>2010-09-18T10:19:21Z</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@gmail.com</email>
</author>
<published>2010-09-14T12:43:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a3c74c52570c0c4ac90c9a0216de800c39089ba7'/>
<id>urn:sha1:a3c74c52570c0c4ac90c9a0216de800c39089ba7</id>
<content type='text'>
@uaddr and @uaddr2 fields in restart_block.futex are user
pointers. Add __user and remove unnecessary casts.

Signed-off-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Darren Hart &lt;dvhltc@us.ibm.com&gt;
LKML-Reference: &lt;1284468228-8723-2-git-send-email-namhyung@gmail.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>futex: Change 3rd arg of fetch_robust_entry() to unsigned int*</title>
<updated>2010-09-18T10:19:21Z</updated>
<author>
<name>Namhyung Kim</name>
<email>namhyung@gmail.com</email>
</author>
<published>2010-09-14T12:43:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1dcc41bb037533839753df983d31778b30b67d93'/>
<id>urn:sha1:1dcc41bb037533839753df983d31778b30b67d93</id>
<content type='text'>
Sparse complains:
 kernel/futex.c:2495:59: warning: incorrect type in argument 3 (different signedness)

Make 3rd argument of fetch_robust_entry() 'unsigned int'.

Signed-off-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Darren Hart &lt;dvhltc@us.ibm.com&gt;
LKML-Reference: &lt;1284468228-8723-1-git-send-email-namhyung@gmail.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>futex: futex_find_get_task remove credentails check</title>
<updated>2010-06-30T22:43:44Z</updated>
<author>
<name>Michal Hocko</name>
<email>mhocko@suse.cz</email>
</author>
<published>2010-06-30T07:51:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7a0ea09ad5352efce8fe79ed853150449903b9f5'/>
<id>urn:sha1:7a0ea09ad5352efce8fe79ed853150449903b9f5</id>
<content type='text'>
futex_find_get_task is currently used (through lookup_pi_state) from two
contexts, futex_requeue and futex_lock_pi_atomic.  None of the paths
looks it needs the credentials check, though.  Different (e)uids
shouldn't matter at all because the only thing that is important for
shared futex is the accessibility of the shared memory.

The credentail check results in glibc assert failure or process hang (if
glibc is compiled without assert support) for shared robust pthread
mutex with priority inheritance if a process tries to lock already held
lock owned by a process with a different euid:

pthread_mutex_lock.c:312: __pthread_mutex_lock_full: Assertion `(-(e)) != 3 || !robust' failed.

The problem is that futex_lock_pi_atomic which is called when we try to
lock already held lock checks the current holder (tid is stored in the
futex value) to get the PI state.  It uses lookup_pi_state which in turn
gets task struct from futex_find_get_task.  ESRCH is returned either
when the task is not found or if credentials check fails.

futex_lock_pi_atomic simply returns if it gets ESRCH.  glibc code,
however, doesn't expect that robust lock returns with ESRCH because it
should get either success or owner died.

Signed-off-by: Michal Hocko &lt;mhocko@suse.cz&gt;
Acked-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Alexey Kuznetsov &lt;kuznet@ms2.inr.ac.ru&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>futex: Handle futex value corruption gracefully</title>
<updated>2010-02-03T14:13:22Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2010-02-03T08:33:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=59647b6ac3050dd964bc556fe6ef22f4db5b935c'/>
<id>urn:sha1:59647b6ac3050dd964bc556fe6ef22f4db5b935c</id>
<content type='text'>
The WARN_ON in lookup_pi_state which complains about a mismatch
between pi_state-&gt;owner-&gt;pid and the pid which we retrieved from the
user space futex is completely bogus.

The code just emits the warning and then continues despite the fact
that it detected an inconsistent state of the futex. A conveniant way
for user space to spam the syslog.

Replace the WARN_ON by a consistency check. If the values do not match
return -EINVAL and let user space deal with the mess it created.

This also fixes the missing task_pid_vnr() when we compare the
pi_state-&gt;owner pid with the futex value.

Reported-by: Jermome Marchand &lt;jmarchan@redhat.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Darren Hart &lt;dvhltc@us.ibm.com&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: &lt;stable@kernel.org&gt;
</content>
</entry>
</feed>
