<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/io_uring/tctx.c, branch linux-7.1.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.1.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.1.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-05-24T18:01:15+00:00</updated>
<entry>
<title>io_uring/tctx: set -&gt;io_uring before publishing the tctx node</title>
<updated>2026-05-24T18:01:15+00:00</updated>
<author>
<name>Lim HyeonJun</name>
<email>shja0831@gmail.com</email>
</author>
<published>2026-05-24T11:08:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a88c02915d9c6160cfc7ab1b26ed64b2993e2b94'/>
<id>urn:sha1:a88c02915d9c6160cfc7ab1b26ed64b2993e2b94</id>
<content type='text'>
io_register_iowq_max_workers() walks ctx-&gt;tctx_list under ctx-&gt;tctx_lock
and dereferences each node's task-&gt;io_uring without a NULL check:

list_for_each_entry(node, &amp;ctx-&gt;tctx_list, ctx_node) {
	tctx = node-&gt;task-&gt;io_uring;
	if (WARN_ON_ONCE(!tctx-&gt;io_wq))
		continue;
	...
}

__io_uring_add_tctx_node() installs the node into ctx-&gt;tctx_list (via
io_tctx_install_node(), which does the list_add() under tctx_lock) and
only assigns current-&gt;io_uring = tctx afterwards. A task doing its first
io_uring operation on a shared ring therefore has a window in which its
node is already visible on ctx-&gt;tctx_list while node-&gt;task-&gt;io_uring is
still NULL. A concurrent IORING_REGISTER_IOWQ_MAX_WORKERS on the same
ring reads that NULL and dereferences tctx-&gt;io_wq:

  KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
  RIP: io_register_iowq_max_workers io_uring/register.c:423

Publish current-&gt;io_uring = tctx before installing the node, so any node
visible on ctx-&gt;tctx_list always has a valid task-&gt;io_uring.

Fixes: 7880174e1e5e ("io_uring/tctx: clean up __io_uring_add_tctx_node() error handling")
Signed-off-by: Lim HyeonJun &lt;shja0831@gmail.com&gt;
Link: https://patch.msgid.link/20260524110853.115634-1-shja0831@gmail.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>io_uring: fix iowq_limits data race in tctx node addition</title>
<updated>2026-04-20T20:57:21+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2026-04-20T14:04:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=42a702aaedf54aa8056fc429fc757a600182e5f7'/>
<id>urn:sha1:42a702aaedf54aa8056fc429fc757a600182e5f7</id>
<content type='text'>
__io_uring_add_tctx_node() reads ctx-&gt;int_flags and
ctx-&gt;iowq_limits[0..1] without holding ctx-&gt;uring_lock, while
io_register_iowq_max_workers() writes these same fields under the lock.

Mostly an application problem if you try and make these race, but let's
silence KCSAN by just grabbing the -&gt;uring_lock around the operation.
This is a slow path operation anyway, and -&gt;uring_lock will be grabbed
by submission right after anyway.

Fixes: 2e480058ddc2 ("io-wq: provide a way to limit max number of workers")
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>io_uring/tctx: mark io_wq as exiting before error path teardown</title>
<updated>2026-04-20T20:47:37+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2026-04-16T16:05:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=41859843f27dd5c8d3bc43489ad9196c96d39f2b'/>
<id>urn:sha1:41859843f27dd5c8d3bc43489ad9196c96d39f2b</id>
<content type='text'>
syzbot reports that it's hitting the below condition for exiting an
io_wq context:

WARN_ON_ONCE(!test_bit(IO_WQ_BIT_EXIT, &amp;wq-&gt;state))

in io_wq_put_and_exit(), which can be triggered with memory allocation
fault injection. Ensure that the io_wq is marked as exiting to silence
this warning trigger.

Reported-by: syzbot+79a4cc863a8db58cd92b@syzkaller.appspotmail.com
Fixes: 7880174e1e5e ("io_uring/tctx: clean up __io_uring_add_tctx_node() error handling")
Reviewed-by: Clément Léger &lt;cleger@meta.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>io_uring/tctx: check for setup tctx-&gt;io_wq before teardown</title>
<updated>2026-04-20T20:47:29+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2026-04-15T20:22:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ee5417fd02cabb6235a89daf5142ffde9aa957fd'/>
<id>urn:sha1:ee5417fd02cabb6235a89daf5142ffde9aa957fd</id>
<content type='text'>
As with the idling code before it, the error exit path should check for
a NULL tctx-&gt;io_wq before calling io_wq_put_and_exit().

Fixes: 7880174e1e5e ("io_uring/tctx: clean up __io_uring_add_tctx_node() error handling")
Reported-by: Dan Carpenter &lt;error27@gmail.com&gt;
Reviewed-by: Clément Léger &lt;cleger@meta.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>io_uring/tctx: clean up __io_uring_add_tctx_node() error handling</title>
<updated>2026-04-08T19:21:34+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2026-04-08T17:31:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7880174e1e5e88944ea75cf871efd77ec5e3ef51'/>
<id>urn:sha1:7880174e1e5e88944ea75cf871efd77ec5e3ef51</id>
<content type='text'>
Refactor __io_uring_add_tctx_node() so that on error it never leaves
current-&gt;io_uring pointing at a half-setup tctx. This moves the
assignment of current-&gt;io_uring to the end of the function post any
failure points.

Separate out the node installation into io_tctx_install_node() to
further clean this up.

Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>io_uring/tctx: have io_uring_alloc_task_context() return tctx</title>
<updated>2026-04-08T19:21:30+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2026-04-08T17:31:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2c453a4281245135b9e6f1048962272c74853b53'/>
<id>urn:sha1:2c453a4281245135b9e6f1048962272c74853b53</id>
<content type='text'>
Instead of having io_uring_alloc_task_context() return an int and
assign tsk-&gt;io_uring, just have it return the task context directly.
This enables cleaner error handling in callers, which may have
failure points post calling io_uring_alloc_task_context().

Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>io_uring: switch struct io_ring_ctx internal bitfields to flags</title>
<updated>2026-03-16T21:32:59+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>axboe@kernel.dk</email>
</author>
<published>2026-03-14T14:41:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f1a424e21c15993db0f9594cda17ef5d516ab3e9'/>
<id>urn:sha1:f1a424e21c15993db0f9594cda17ef5d516ab3e9</id>
<content type='text'>
Bitfields cannot be set and checked atomically, and this makes it more
clear that these are indeed in shared storage and must be checked and
set in a sane fashion. This is in preparation for annotating a few of
the known racy, but harmless, flags checking.

No intended functional changes in this patch.

Reviewed-by: Gabriel Krisman Bertazi &lt;krisman@suse.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>Convert 'alloc_obj' family to use the new default GFP_KERNEL argument</title>
<updated>2026-02-22T01:09:51+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-02-22T00:37:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43'/>
<id>urn:sha1:bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43</id>
<content type='text'>
This was done entirely with mindless brute force, using

    git grep -l '\&lt;k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>treewide: Replace kmalloc with kmalloc_obj for non-scalar types</title>
<updated>2026-02-21T09:02:28+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees@kernel.org</email>
</author>
<published>2026-02-21T07:49:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=69050f8d6d075dc01af7a5f2f550a8067510366f'/>
<id>urn:sha1:69050f8d6d075dc01af7a5f2f550a8067510366f</id>
<content type='text'>
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>io_uring/tctx: avoid modifying loop variable in io_ring_add_registered_file</title>
<updated>2026-02-10T03:12:46+00:00</updated>
<author>
<name>Yang Xiuwei</name>
<email>yangxiuwei@kylinos.cn</email>
</author>
<published>2026-02-10T02:34:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=daa0b901f8319414cf9f56237f15240b95e4b1b2'/>
<id>urn:sha1:daa0b901f8319414cf9f56237f15240b95e4b1b2</id>
<content type='text'>
Use a separate 'idx' variable to store the result of array_index_nospec()
instead of modifying the loop variable 'offset' directly. This improves
code clarity by separating the logical index from the sanitized index
used for array access.

No functional change intended.

Signed-off-by: Yang Xiuwei &lt;yangxiuwei@kylinos.cn&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
