Linux kernel fuse: io-uring teardown and commit-fetch race conditions
Four use-after-free and ordering races in the FUSE io-uring path, reported with a KASAN reproducer and fixed upstream. Reported-by credit on all four merged commits.
Background
This writeup is about a class of bugs I reported, not patches I wrote. The distinction matters and I want it clear from the top. The four fixes that landed upstream were authored by Bernd Schubert (three) and Zhenghang Xiao (one), reviewed by Joanne Koong, and merged by Miklos Szeredi. My contribution was the report, the race analysis, and a KASAN reproducer that pinned down one of the four. Each merged commit carries Reported-by: Berkant Koc <me@berkoc.com>, alongside co-reporters where the same window was found independently. That is the honest framing and it is also the strong one.
FUSE (Filesystem in Userspace) lets an unprivileged userspace daemon back a mounted filesystem. The kernel side lives in fs/fuse/. In Linux 6.14 the subsystem gained an io-uring transport: instead of the daemon reading requests from /dev/fuse with read/write, it registers a set of io-uring queues and exchanges requests through COMMIT_AND_FETCH SQEs. The transport code is in fs/fuse/dev_uring.c, introduced by commit c090c8abae4b ("fuse: Add io-uring sqe commit and fetch support"). That commit is the Fixes: target for the bugs here, so the affected range is 6.14 onward.
The io-uring transport keeps per-queue arrays of ring entries (struct fuse_ring_ent). An entry moves through a small state machine: available, handed to userspace, committed back. Two pointers tie the structures together: ent->fuse_req points at the in-flight struct fuse_req an entry is currently serving, and req->ring_entry points back. The cleanup and abort machinery has to take both down in the right order, under queue->lock, or a freed fuse_req or a freed ring entry stays reachable from the other side.
The threat model is local. A FUSE filesystem can be mounted from inside a user namespace on distributions that enable unprivileged user namespaces (Ubuntu, Debian 11+, Fedora). On those, the daemon that drives the io-uring queues is attacker-controlled and runs as an unprivileged local user. On RHEL-style configurations where a FUSE mount requires real root, the same code is reachable but the privilege bar is higher. None of this is remote and none of it is a guest-to-host escape; it is local-user-against-kernel.
The bugs
There are four distinct issues. They cluster in the same teardown and commit-fetch machinery in dev_uring.c and dev.c, which is why the maintainers chose to fix them as one series rather than piecemeal. I will describe them by what goes wrong, not by line numbers I cannot still vouch for against the merged tree, because the code moved across the fuse/for-next rebase between report and merge.
**1. UAF in the async teardown drain (fuse_uring_async_stop_queues).** This is the one I reproduced under KASAN. fuse_abort_conn() reaches the io-uring teardown, runs one synchronous pass over the queues, and if entries remain it schedules ring->async_teardown_work as delayed work (FUSE_URING_TEARDOWN_INTERVAL, HZ/20). Separately, fuse_dev_release() on the last device of a connection calls fuse_abort_conn(fc) and then fuse_conn_put(fc) with nothing waiting in between. When that put drops the last reference, call_rcu() arms delayed_release(), which after the grace period calls fuse_uring_destruct() and kfree()s the ring entries. The previously scheduled async_teardown_work then runs fuse_uring_teardown_all_queues() and walks per-queue lists that point into freed slab. KASAN catches the read of ent->list.next out of a freed kmalloc-192 object. The fix establishes a reference to the fuse_conn (so the connection cannot be torn down underneath the delayed work) and drains the work before the structures are freed.
**2. queue->stopped read/write races.** The stopped flag that gates teardown was set and read without consistent locking, so a writer and a reader could disagree about whether a queue was being torn down. The fix sets and reads the value under the lock.
**3. fuse_req findable on a malicious commit SQE before the copy completes.** On the commit-and-fetch path, the request was made discoverable (added to the per-queue processing structure) before the SQE payload had been copied in. A malicious daemon could commit against a request that was visible but not yet fully set up. The fix moves fuse_uring_add_to_pq to after the memcpy, so the request is only findable once it is fully populated, closing a UAF reachable through a crafted commit SQE.
4. UAF in the commit-fetch error path. fuse_uring_commit_fetch() locates a request, removes it from the processing queue, and on the error branch (the entry is not in the expected FRRS_USERSPACE state) it ends the request directly without clearing ent->fuse_req. The dangling ent->fuse_req then survives into teardown, which reads it and ends the request a second time on freed memory. The fix clears ent->fuse_req in that error path, routing it through fuse_uring_req_end() so the clear happens under queue->lock. This is the one I first reported as a static-analysis finding; it turned out Zhenghang Xiao had independently reported the same window the Friday before, across the whole copy path in fuse_uring_prepare_send(), and the fix that landed is broader than my single-point clear and credits Zhenghang as the author.
The common shape across all four is a teardown or commit path that drops a pointer's owning lock, or frees a structure, while another path still holds a reference to it. CWE-416 (use-after-free) with CWE-362 (race condition) underneath.
What I verified, and what I did not
I want to be precise about verification level, because three of these four were static analysis on my end and one was live.
The async-teardown UAF (bug 1) I reproduced under KASAN in QEMU. The harness is a libfuse-style daemon (around 400 lines of C) that negotiates FUSE_OVER_IO_URING, registers four queues of eight entries each, runs sixteen COMMIT_AND_FETCH worker threads, then aborts by closing /dev/fuse. On a vanilla 4-CPU KASAN kernel built from the tree at report time, the race window was too narrow to trigger from userspace alone: zero KASAN trips in 50 iterations. With a PoC-only mdelay() inserted into the teardown path to widen the gap, KASAN fired reliably, 2 of 2 independent runs. The trace shows the free site at fuse_uring_destruct via delayed_release via rcu_core, and the use site at fuse_uring_teardown_all_queues inside fuse_uring_async_stop_queues on a workqueue. I later reran a two-arm comparison (revert vs apply) against the maintainer fix on fuse/for-next: with the fix reverted and the widening kept, KASAN fired at iteration 1 within 8 seconds; with the fix applied, 10 iterations clean under KASAN, lockdep, and kmemleak. I scoped that confirmation to bug 1 only, because the harness does not specifically exercise the queue->stopped ordering, the memcpy-window, or the commit_fetch error branch. I did not request a Tested-by: trailer; the credit that landed on the merged commits is Reported-by:, which is the accurate tag for what I contributed.
The other three (bugs 2, 3, 4) I reported from reading the code. I did not build a separate reproducer for each, and I did not claim live-repro on them. The commit-fetch error-path bug in particular I initially over-narrowed: I proposed clearing ent->fuse_req only on that one branch, and Bernd pointed out the same window is reachable across the whole copy path, so a single-point clear leaves the race open on other exits. He was right and I withdrew my narrow version rather than push a v2. That correction is part of the record and it improved the fix.
The "race window is too narrow without injected delay" caveat is real and I stated it in the original report. These are tight races. A vanilla kernel on a small VM does not hit them easily from userspace alone. They are still genuine UAFs reachable on the abort and last-device-release paths, and KASAN confirms the bad access once the window is widened. I did not construct an exploitation primitive beyond the KASAN-observed bad read.
Disclosure and coordination
I sent the initial report on 2026-05-17 to Miklos Szeredi and Bernd Schubert, with security@kernel.org and Joanne Koong in copy. Per the kernel.org security-bugs process I kept the public vger lists and linux-distros out of the initial recipients until a fix was accepted. Greg KH replied asking to take it on-list, which moved the discussion to the normal [PATCH] flow. One early routing mistake on my side: I CC'd linux-fuse@vger.kernel.org, which does not exist and bounced; the correct community list is fuse-devel@lists.linux.dev, and Bernd pointed me at it.
The fixes were authored upstream. Bernd Schubert posted a four-patch series, "fuse: Fix several io-uring race conditions" (20260518-fuse-io-uring-race-fixes-v1), explicitly noting it fixed races reported by Berkant and Zhenghang. Joanne Koong (Meta) gave Reviewed-by: across the series. There was a base-tree wrinkle worth recording: an early version of one patch referenced a fuse_chan abstraction (ring->chan, chan->conn) that does not exist on mainline; it was based on Miklos' for-next branch where the fuse_chan work had landed, so the mainline-targeted version uses ring->fc instead. That distinction matters for the 6.14 stable backport, where the field name differs.
Merge happened in two steps:
- 2026-06-09: Miklos applied the first three fixes ("Applied, thanks").
- 2026-06-15: Miklos applied the fourth, the commit-fetch error-path fix authored by Zhenghang Xiao ("Applied, thanks").
The Fixes: tags point at c090c8abae4b and 4a9bfb9b6850, and the series carries Cc: stable@vger.kernel.org for 6.14+, so backports to 6.14-stable follow the normal stable flow.
Credit and what the tags mean
On every one of the four merged commits I am Reported-by:, with co-reporters (Zhenghang Xiao, xlabai, Shuvam) on the entries that were found independently in parallel. I am not Tested-by: or Signed-off-by: on any of them. I reproduced the teardown UAF (bug 1) under KASAN, but the credit that landed is Reported-by:, and that is the correct tag for a reporter who did not author the fixes. I would not want it stated otherwise.
The tag discipline here is the same lesson the kernel teaches everywhere. Reported-by: is the person who found and reported the bug. Signed-off-by: is the author of the patch. Reviewed-by: is someone who reviewed it. Tested-by: is someone who tested it. My reproducer only exercised one of the four paths, so a series-wide Tested-by: would have been inaccurate; I did not claim one, and the credit I carry on every commit is Reported-by:. Claiming a tag off a single-path harness is exactly what reviewers notice.
References
- Disclosure thread on
lore.kernel.org: https://lore.kernel.org/all/20260517095846.fuse-iouring-uaf.dc5f5dbb71dc@berkoc.com/ - Bernd Schubert's fix series on
lore.kernel.org: https://lore.kernel.org/all/20260518-fuse-io-uring-race-fixes-v1-0-36c9eba8ab18@bsbernd.com/ fs/fuse/dev_uring.c,fs/fuse/dev.c,fs/fuse/inode.cin the mainline treeFixes:commitsc090c8abae4b("fuse: Add io-uring sqe commit and fetch support") and4a9bfb9b6850- CWE-416: Use After Free; CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization
- Linux kernel
Documentation/process/security-bugs.rstfor the maintainer-first disclosure flow