<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/fs/fuse/dev_uring.c, branch v6.14</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>fuse: fix uring race condition for null dereference of fc</title>
<updated>2025-03-19T08:24:03+00:00</updated>
<author>
<name>Joanne Koong</name>
<email>joannelkoong@gmail.com</email>
</author>
<published>2025-03-18T00:30:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d9ecc77193cad25402ff5517fb26fb22b4db0e10'/>
<id>d9ecc77193cad25402ff5517fb26fb22b4db0e10</id>
<content type='text'>
There is a race condition leading to a kernel crash from a null
dereference when attemping to access fc-&gt;lock in
fuse_uring_create_queue(). fc may be NULL in the case where another
thread is creating the uring in fuse_uring_create() and has set
fc-&gt;ring but has not yet set ring-&gt;fc when fuse_uring_create_queue()
reads ring-&gt;fc. There is another race condition as well where in
fuse_uring_register(), ring-&gt;nr_queues may still be 0 and not yet set
to the new value when we compare qid against it.

This fix sets fc-&gt;ring only after ring-&gt;fc and ring-&gt;nr_queues have been
set, which guarantees now that ring-&gt;fc is a proper pointer when any
queues are created and ring-&gt;nr_queues reflects the right number of
queues if ring is not NULL. We must use smp_store_release() and
smp_load_acquire() semantics to ensure the ordering will remain correct
where fc-&gt;ring is assigned only after ring-&gt;fc and ring-&gt;nr_queues have
been assigned.

Signed-off-by: Joanne Koong &lt;joannelkoong@gmail.com&gt;
Link: https://lore.kernel.org/r/20250318003028.3330599-1-joannelkoong@gmail.com
Fixes: 24fe962c86f5 ("fuse: {io-uring} Handle SQEs - register commands")
Acked-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
Reviewed-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is a race condition leading to a kernel crash from a null
dereference when attemping to access fc-&gt;lock in
fuse_uring_create_queue(). fc may be NULL in the case where another
thread is creating the uring in fuse_uring_create() and has set
fc-&gt;ring but has not yet set ring-&gt;fc when fuse_uring_create_queue()
reads ring-&gt;fc. There is another race condition as well where in
fuse_uring_register(), ring-&gt;nr_queues may still be 0 and not yet set
to the new value when we compare qid against it.

This fix sets fc-&gt;ring only after ring-&gt;fc and ring-&gt;nr_queues have been
set, which guarantees now that ring-&gt;fc is a proper pointer when any
queues are created and ring-&gt;nr_queues reflects the right number of
queues if ring is not NULL. We must use smp_store_release() and
smp_load_acquire() semantics to ensure the ordering will remain correct
where fc-&gt;ring is assigned only after ring-&gt;fc and ring-&gt;nr_queues have
been assigned.

Signed-off-by: Joanne Koong &lt;joannelkoong@gmail.com&gt;
Link: https://lore.kernel.org/r/20250318003028.3330599-1-joannelkoong@gmail.com
Fixes: 24fe962c86f5 ("fuse: {io-uring} Handle SQEs - register commands")
Acked-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
Reviewed-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: prevent disabling io-uring on active connections</title>
<updated>2025-01-27T17:02:23+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bschubert@ddn.com</email>
</author>
<published>2025-01-23T16:55:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2d4fde59fd502a65c1698b61ad4d0f10a9ab665a'/>
<id>2d4fde59fd502a65c1698b61ad4d0f10a9ab665a</id>
<content type='text'>
The enable_uring module parameter allows administrators to enable/disable
io-uring support for FUSE at runtime. However, disabling io-uring while
connections already have it enabled can lead to an inconsistent state.

Fix this by keeping io-uring enabled on connections that were already using
it, even if the module parameter is later disabled. This ensures active
FUSE mounts continue to function correctly.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The enable_uring module parameter allows administrators to enable/disable
io-uring support for FUSE at runtime. However, disabling io-uring while
connections already have it enabled can lead to an inconsistent state.

Fix this by keeping io-uring enabled on connections that were already using
it, even if the module parameter is later disabled. This ensures active
FUSE mounts continue to function correctly.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: enable fuse-over-io-uring</title>
<updated>2025-01-27T17:02:23+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bschubert@ddn.com</email>
</author>
<published>2025-01-20T01:29:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=786412a73e7ee5b00ef3437bbf2f3a250759b2ae'/>
<id>786412a73e7ee5b00ef3437bbf2f3a250759b2ae</id>
<content type='text'>
All required parts are handled now, fuse-io-uring can
be enabled.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All required parts are handled now, fuse-io-uring can
be enabled.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: block request allocation until io-uring init is complete</title>
<updated>2025-01-27T17:02:23+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bernd@bsbernd.com</email>
</author>
<published>2025-01-20T01:29:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=3393ff964e0fa5def66570c54a4612bf9df06b76'/>
<id>3393ff964e0fa5def66570c54a4612bf9df06b76</id>
<content type='text'>
Avoid races and block request allocation until io-uring
queues are ready.

This is a especially important for background requests,
as bg request completion might cause lock order inversion
of the typical queue-&gt;lock and then fc-&gt;bg_lock

    fuse_request_end
       spin_lock(&amp;fc-&gt;bg_lock);
       flush_bg_queue
         fuse_send_one
           fuse_uring_queue_fuse_req
           spin_lock(&amp;queue-&gt;lock);

Signed-off-by: Bernd Schubert &lt;bernd@bsbernd.com&gt;
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Avoid races and block request allocation until io-uring
queues are ready.

This is a especially important for background requests,
as bg request completion might cause lock order inversion
of the typical queue-&gt;lock and then fc-&gt;bg_lock

    fuse_request_end
       spin_lock(&amp;fc-&gt;bg_lock);
       flush_bg_queue
         fuse_send_one
           fuse_uring_queue_fuse_req
           spin_lock(&amp;queue-&gt;lock);

Signed-off-by: Bernd Schubert &lt;bernd@bsbernd.com&gt;
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: {io-uring} Prevent mount point hang on fuse-server termination</title>
<updated>2025-01-27T17:02:21+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bschubert@ddn.com</email>
</author>
<published>2025-01-20T01:29:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b6236c8407cba5d7a108facb1bcfab24994d3814'/>
<id>b6236c8407cba5d7a108facb1bcfab24994d3814</id>
<content type='text'>
When the fuse-server terminates while the fuse-client or kernel
still has queued URING_CMDs, these commands retain references
to the struct file used by the fuse connection. This prevents
fuse_dev_release() from being invoked, resulting in a hung mount
point.

This patch addresses the issue by making queued URING_CMDs
cancelable, allowing fuse_dev_release() to proceed as expected
and preventing the mount point from hanging.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the fuse-server terminates while the fuse-client or kernel
still has queued URING_CMDs, these commands retain references
to the struct file used by the fuse connection. This prevents
fuse_dev_release() from being invoked, resulting in a hung mount
point.

This patch addresses the issue by making queued URING_CMDs
cancelable, allowing fuse_dev_release() to proceed as expected
and preventing the mount point from hanging.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: Allow to queue bg requests through io-uring</title>
<updated>2025-01-27T17:01:22+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bschubert@ddn.com</email>
</author>
<published>2025-01-20T01:29:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=857b0263f30eebe13ab4b6a65156a0d6c8fc2210'/>
<id>857b0263f30eebe13ab4b6a65156a0d6c8fc2210</id>
<content type='text'>
This prepares queueing and sending background requests through
io-uring.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This prepares queueing and sending background requests through
io-uring.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: Allow to queue fg requests through io-uring</title>
<updated>2025-01-27T17:01:22+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bschubert@ddn.com</email>
</author>
<published>2025-01-20T01:29:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c2c9af9a0b13261c36909036057a116f2edb5e1a'/>
<id>c2c9af9a0b13261c36909036057a116f2edb5e1a</id>
<content type='text'>
This prepares queueing and sending foreground requests through
io-uring.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This prepares queueing and sending foreground requests through
io-uring.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: {io-uring} Handle teardown of ring entries</title>
<updated>2025-01-27T17:01:12+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bschubert@ddn.com</email>
</author>
<published>2025-01-20T01:29:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4a9bfb9b6850fec0685447aed280533cf980de70'/>
<id>4a9bfb9b6850fec0685447aed280533cf980de70</id>
<content type='text'>
On teardown struct file_operations::uring_cmd requests
need to be completed by calling io_uring_cmd_done().
Not completing all ring entries would result in busy io-uring
tasks giving warning messages in intervals and unreleased
struct file.

Additionally the fuse connection and with that the ring can
only get released when all io-uring commands are completed.

Completion is done with ring entries that are
a) in waiting state for new fuse requests - io_uring_cmd_done
is needed

b) already in userspace - io_uring_cmd_done through teardown
is not needed, the request can just get released. If fuse server
is still active and commits such a ring entry, fuse_uring_cmd()
already checks if the connection is active and then complete the
io-uring itself with -ENOTCONN. I.e. special handling is not
needed.

This scheme is basically represented by the ring entry state
FRRS_WAIT and FRRS_USERSPACE.

Entries in state:
- FRRS_INIT: No action needed, do not contribute to
  ring-&gt;queue_refs yet
- All other states: Are currently processed by other tasks,
  async teardown is needed and it has to wait for the two
  states above. It could be also solved without an async
  teardown task, but would require additional if conditions
  in hot code paths. Also in my personal opinion the code
  looks cleaner with async teardown.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On teardown struct file_operations::uring_cmd requests
need to be completed by calling io_uring_cmd_done().
Not completing all ring entries would result in busy io-uring
tasks giving warning messages in intervals and unreleased
struct file.

Additionally the fuse connection and with that the ring can
only get released when all io-uring commands are completed.

Completion is done with ring entries that are
a) in waiting state for new fuse requests - io_uring_cmd_done
is needed

b) already in userspace - io_uring_cmd_done through teardown
is not needed, the request can just get released. If fuse server
is still active and commits such a ring entry, fuse_uring_cmd()
already checks if the connection is active and then complete the
io-uring itself with -ENOTCONN. I.e. special handling is not
needed.

This scheme is basically represented by the ring entry state
FRRS_WAIT and FRRS_USERSPACE.

Entries in state:
- FRRS_INIT: No action needed, do not contribute to
  ring-&gt;queue_refs yet
- All other states: Are currently processed by other tasks,
  async teardown is needed and it has to wait for the two
  states above. It could be also solved without an async
  teardown task, but would require additional if conditions
  in hot code paths. Also in my personal opinion the code
  looks cleaner with async teardown.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: Add io-uring sqe commit and fetch support</title>
<updated>2025-01-27T16:36:41+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bschubert@ddn.com</email>
</author>
<published>2025-01-20T01:29:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c090c8abae4b6b77a1bee116aa6c385456ebef96'/>
<id>c090c8abae4b6b77a1bee116aa6c385456ebef96</id>
<content type='text'>
This adds support for fuse request completion through ring SQEs
(FUSE_URING_CMD_COMMIT_AND_FETCH handling). After committing
the ring entry it becomes available for new fuse requests.
Handling of requests through the ring (SQE/CQE handling)
is complete now.

Fuse request data are copied through the mmaped ring buffer,
there is no support for any zero copy yet.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds support for fuse request completion through ring SQEs
(FUSE_URING_CMD_COMMIT_AND_FETCH handling). After committing
the ring entry it becomes available for new fuse requests.
Handling of requests through the ring (SQE/CQE handling)
is complete now.

Fuse request data are copied through the mmaped ring buffer,
there is no support for any zero copy yet.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: {io-uring} Handle SQEs - register commands</title>
<updated>2025-01-24T10:54:08+00:00</updated>
<author>
<name>Bernd Schubert</name>
<email>bschubert@ddn.com</email>
</author>
<published>2025-01-20T01:28:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=24fe962c86f55347385933a1b06ca71b60854690'/>
<id>24fe962c86f55347385933a1b06ca71b60854690</id>
<content type='text'>
This adds basic support for ring SQEs (with opcode=IORING_OP_URING_CMD).
For now only FUSE_IO_URING_CMD_REGISTER is handled to register queue
entries.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds basic support for ring SQEs (with opcode=IORING_OP_URING_CMD).
For now only FUSE_IO_URING_CMD_REGISTER is handled to register queue
entries.

Signed-off-by: Bernd Schubert &lt;bschubert@ddn.com&gt;
Reviewed-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt; # io_uring
Reviewed-by: Luis Henriques &lt;luis@igalia.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
