<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/futex/futex.h, branch linux-6.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-03-22T19:54:14Z</updated>
<entry>
<title>futex: Pass in task to futex_queue()</title>
<updated>2025-03-22T19:54:14Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2025-01-15T16:05:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=aa189c394168ad53d8eacb82a1cc258d2cd90129'/>
<id>urn:sha1:aa189c394168ad53d8eacb82a1cc258d2cd90129</id>
<content type='text'>
[ Upstream commit 5e0e02f0d7e52cfc8b1adfc778dd02181d8b47b4 ]

futex_queue() -&gt; __futex_queue() uses 'current' as the task to store in
the struct futex_q-&gt;task field. This is fine for synchronous usage of
the futex infrastructure, but it's not always correct when used by
io_uring where the task doing the initial futex_queue() might not be
available later on. This doesn't lead to any issues currently, as the
io_uring side doesn't support PI futexes, but it does leave a
potentially dangling pointer which is never a good idea.

Have futex_queue() take a task_struct argument, and have the regular
callers pass in 'current' for that. Meanwhile io_uring can just pass in
NULL, as the task should never be used off that path. In theory
req-&gt;tctx-&gt;task could be used here, but there's no point populating it
with a task field that will never be used anyway.

Reported-by: Jann Horn &lt;jannh@google.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/all/22484a23-542c-4003-b721-400688a0d055@kernel.dk
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>futex: make the vectored futex operations available</title>
<updated>2023-09-29T08:37:07Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2023-06-13T14:34:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e9a56c9325ef28d5481712e85dd5d3f8b2a68e88'/>
<id>urn:sha1:e9a56c9325ef28d5481712e85dd5d3f8b2a68e88</id>
<content type='text'>
Rename unqueue_multiple() as futex_unqueue_multiple(), and make both
that and futex_wait_multiple_setup() available for external users. This
is in preparation for wiring up vectored waits in io_uring.

Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>futex: make futex_parse_waitv() available as a helper</title>
<updated>2023-09-29T08:37:05Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2023-06-13T14:31:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5177c0cb306a8628bafbf1e6b7aa7e1b7436b8dc'/>
<id>urn:sha1:5177c0cb306a8628bafbf1e6b7aa7e1b7436b8dc</id>
<content type='text'>
To make it more generically useful, augment it with allowing the caller
to pass in the wake handler and wake data. Convert the futex_waitv()
syscall, passing in the default handlers.

Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>futex: add wake_data to struct futex_q</title>
<updated>2023-09-29T08:37:01Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2023-06-13T21:44:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8af1692616d993c93a080865a7f19506733aa462'/>
<id>urn:sha1:8af1692616d993c93a080865a7f19506733aa462</id>
<content type='text'>
With handling multiple futex_q for waitv, we cannot easily go from the
futex_q to data related to that request or queue. Add a wake_data
argument that belongs to the wake handler assigned.

Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>futex: abstract out a __futex_wake_mark() helper</title>
<updated>2023-09-29T08:36:54Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2023-07-12T15:14:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e52c43403c9b839a30a9cfc4b75109581389d764'/>
<id>urn:sha1:e52c43403c9b839a30a9cfc4b75109581389d764</id>
<content type='text'>
Move the unqueue and lock_ptr clear into a helper that futex_wake_mark()
calls. Add it to the public functions as well, in preparation for using
it outside the core futex code.

Suggested-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>futex: factor out the futex wake handling</title>
<updated>2023-09-29T08:36:50Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2023-06-08T17:56:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=12a4be50aff30ee8f2c6a64020c82a4e997e8d6c'/>
<id>urn:sha1:12a4be50aff30ee8f2c6a64020c82a4e997e8d6c</id>
<content type='text'>
In preparation for having another waker that isn't futex_wake_mark(),
add a wake handler in futex_q. No extra data is associated with the
handler outside of struct futex_q itself. futex_wake_mark() is defined as
the standard wakeup helper, now set through futex_q_init like other
defaults.

Normal sync futex waiting relies on wake_q holding tasks that should
be woken up. This is what futex_wake_mark() does, it'll unqueue the
futex and add the associated task to the wake queue. For async usage of
futex waiting, rather than having tasks sleeping on the futex, we'll
need to deal with a futex wake differently. For the planned io_uring
case, that means posting a completion event for the task in question.
Having a definable wake handler can help support that use case.

Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>futex: move FUTEX2_VALID_MASK to futex.h</title>
<updated>2023-09-29T08:36:16Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2023-07-21T14:41:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3b0781595431acafe3db6596e12deb46975d91dd'/>
<id>urn:sha1:3b0781595431acafe3db6596e12deb46975d91dd</id>
<content type='text'>
We need this for validating the futex2 flags outside of the normal
futex syscalls.

Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>futex: Add flags2 argument to futex_requeue()</title>
<updated>2023-09-21T17:22:09Z</updated>
<author>
<name>peterz@infradead.org</name>
</author>
<published>2023-09-21T10:45:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=27b88f3519e72d71c8cead6b835a26c171109c9b'/>
<id>urn:sha1:27b88f3519e72d71c8cead6b835a26c171109c9b</id>
<content type='text'>
In order to support mixed size requeue, add a second flags argument to
the internal futex_requeue() function.

No functional change intended.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20230921105248.396780136@noisy.programming.kicks-ass.net
</content>
</entry>
<entry>
<title>futex: Propagate flags into get_futex_key()</title>
<updated>2023-09-21T17:22:09Z</updated>
<author>
<name>peterz@infradead.org</name>
</author>
<published>2023-09-21T10:45:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3b63a55f498b763aba0886b244df613587a73c46'/>
<id>urn:sha1:3b63a55f498b763aba0886b244df613587a73c46</id>
<content type='text'>
Instead of only passing FLAGS_SHARED as a boolean, pass down flags as
a whole.

No functional change intended.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/r/20230921105248.282857501@noisy.programming.kicks-ass.net
</content>
</entry>
<entry>
<title>futex: Add sys_futex_wait()</title>
<updated>2023-09-21T17:22:08Z</updated>
<author>
<name>peterz@infradead.org</name>
</author>
<published>2023-09-21T10:45:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cb8c4312afca1b2dc64107e7e7cea81911055612'/>
<id>urn:sha1:cb8c4312afca1b2dc64107e7e7cea81911055612</id>
<content type='text'>
To complement sys_futex_waitv()/wake(), add sys_futex_wait(). This
syscall implements what was previously known as FUTEX_WAIT_BITSET
except it uses 'unsigned long' for the value and bitmask arguments,
takes timespec and clockid_t arguments for the absolute timeout and
uses FUTEX2 flags.

The 'unsigned long' allows FUTEX2_SIZE_U64 on 64bit platforms.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Geert Uytterhoeven &lt;geert@linux-m68k.org&gt;
Link: https://lore.kernel.org/r/20230921105248.164324363@noisy.programming.kicks-ass.net
</content>
</entry>
</feed>
