Skip to contentSkip to conversation

forged reply bit triggers WARN_ON in fuse-over-io_uring

DISCUSSION Bernd Schubert 1 participant 1 message Nov 20 1 message not in the archive FUSE filesystem core

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines · On 11/20/26 03:12, n3rd wrote:

Hello,

I am reporting a bug in the Linux kernel.

Quoted 7 lines

1. Affected kernel versions
Linux v7.3-rc7 (mainline, tested as 7.3.0-rc7) is affected and was reproduced here. The same code is present in mainline 65ba8f34ec88 (checked on 2026-10-28, fs/fuse/dev_uring.c unchanged in that area). The v7.2.x and 6.x stable branches were not tested or bisected, so no claim is made about them. The code has been there since the fuse-over-io_uring channel was introduced.

Feel free to send a patch that changes to pr_info_ratelimited().

Thanks,
Bernd

Quoted 83 lines

2. Problem description
fuse-over-io_uring keeps the FUSE request and reply headers in daemon memory. When a daemon commits a reply, fuse_uring_commit_fetch() uses copy_header_from_ring() to copy the 128-byte in_out area of the ring entry into a kernel buffer; the first 16 bytes are struct fuse_out_header (len, error, unique), entirely supplied by the daemon. fuse_uring_out_header_has_err() then validates that header: it only rejects unique == 0, only checks the error range, and at the unique comparison it uses (oh->unique & ~FUSE_INT_REQ_BIT) != req->in.h.unique, which masks off exactly the bit the later WARN_ON_ONCE tests. Kernel- generated unique values are always even (fuse_get_unique_locked() adds FUSE_REQ_ID_STEP, defined as 1ULL << 1), so bit 0 is normally always zero; a daemon that replies with unique = commit_id | 1 passes the mask comparison and then necessarily hits WARN_ON_ONCE(oh->unique & FUSE_INT_REQ_BIT) at fs/fuse/dev_uring.c:653. On a default kernel this prints one WARNING per boot and the reply is still treated as a normal success (err = 0), so there is no memory corruption, no out-of-bounds access, no use-after-free and no privilege escalation. On a kernel built or booted with panic_on_warn=1, which is common for Android, ChromeOS and hardened/cloud kernels, the same single forged bit panics the whole machine, and the user can do it again after every reboot. The legacy / dev/fuse path (fs/fuse/dev.c, interrupt reply branch) handles the very same input as an ordinary error branch and does not warn, which is why this looks like a bug in the io_uring path rather than intended behaviour.

3. Reproducer
A self-contained C program (about 450 lines, static, no libfuse) mounts its own fuse filesystem, answers FUSE_INIT with FUSE_OVER_IO_URING, registers ring entries with IORING_OP_URING_CMD through a raw SQE128 io_uring, then replies to the FUSE_LOOKUP generated by a child open() with an out header whose unique is commit_id | FUSE_INT_REQ_BIT and commits it. A negative control replies with unique = commit_id (bit 0 clear) through the same mount and the same path. The complete reproducer and the serial logs are available on request; they are not posted here.

4. Conditions
Four conditions: (1) fuse.enable_uring=1. That is module_param(bool, 0644), off by default and writable by root only; I found no distribution that enables it by default, so an operator has to turn it on for performance, usually via /etc/modprobe.d or the kernel command line. (2) The attacker can open /dev/fuse, which udev's 50-udev-default.rules makes mode 0666 on a normal distribution. (3) kernel.io_uring_disabled=0 and support for IORING_SETUP_SQE128 and IORING_OP_URING_CMD. (4) The attacker's daemon completes FUSE_INIT and registers ring entries. The attacker does not need root or CAP_SYS_ADMIN; with CONFIG_USER_NS the whole sequence runs inside an unprivileged user namespace, which is what was tested here (uid 1000, setuid then unshare(CLONE_NEWUSER| CLONE_NEWNS); the kernel printed CPU: 0 UID: 1000 before panicking). Triggering is deterministic and needs no race. Tested on x86_64, QEMU 6.2 TCG, 2 vCPUs, 2048 MB, initramfs, 7.3.0-rc7, with KASAN enabled as a control that stayed silent.

5. Suspected location
fs/fuse/dev_uring.c: fuse_uring_out_header_has_err() (v7.3-rc7 line 653, the WARN_ON_ONCE), reached from fuse_uring_commit_fetch() and copy_header_from_ring(); contrast fs/fuse/dev.c line 1947 (legacy interrupt reply handling).

6. Suggested fix
Do not assert on a field the daemon controls. Handle it like the legacy
path: if (oh->unique & FUSE_INT_REQ_BIT) { pr_warn_ratelimited(...); err = -ENOENT; goto err; }. A regression test that replies with unique = commit_id | 1 and expects no WARN and an -ENOENT rejection would cover it.

7. Mitigation
Keep fuse.enable_uring=0 (the default) and do not enable it for performance; deployments that already enabled it should turn it off and reload fuse. On hardened kernels, setting panic_on_warn=0 only downgrades the panic to a WARNING and does not fix the bug.

8. Disclosure
Public. Per the kernel security process this report is being sent to the public mailing list and the fuse maintainers with the security team copied; no embargo is requested and no CVE was assigned here. The reproducer is not posted publicly; it is available on request.

9. AI-assistance note
This report was prepared with an AI coding assistant, which was used for source review, for building and driving the QEMU guest used to reproduce the issue, and for drafting this text. Per the kernel security process I am treating the issue as public and am not posting the reproducer.