From: Cheng Yongkang <teel4res@gmail.com>
To: Benjamin LaHaise <bcrl@kvack.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>,
linux-aio@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [BUG] fs/aio: io_setup integer wrap can exhaust global aio quota
Date: Thu, 22 Oct 2026 02:17:48 -0700 [thread overview]
Message-ID: <20261022091748.3653127-1-teel4res@gmail.com> (raw)
Hi all,
ioctx_alloc() saves the 32-bit nr_events in max_reqs, then doubles
nr_events before checking the ring-size bound. For
nr_events=0x80000001, the doubled value wraps to 2, so the ring check
passes and aio_setup_ring() builds a one-page/127-slot ring. The
original 0x80000001 is still stored in ctx->max_reqs and charged to the
global aio_nr quota.
If an administrator has raised fs.aio-max-nr to at least 0x80000001,
an unprivileged process can create that context and make later normal
io_setup() calls fail with -EAGAIN until the wrapped context is
destroyed.
Observed on Linux v7.3, commit
08ab31164c55f20c7a2653de3186ae333470e2c1, with the administrator
raising fs.aio-max-nr to 2147483649 and dropping to uid/gid 65534:
io_setup(0x80000001): ret=0
fs.aio-nr: 2147483649
ring header nr: 127
ring VMA size: 4096
io_setup(1): -EAGAIN while wrapped context alive
io_destroy(): 0
fs.aio-nr after: 0
The unprivileged io_submit path stopped at the ring's real 127-slot
capacity.
The default fs.aio-max-nr=65536 blocks the path, so this requires the
documented but unusually large administrator configuration. Under that
configuration it is a system-wide availability failure.
Check the magnitude before doubling, or use a 64-bit intermediate and
charge the actual validated request count.
I found no matching upstream fix or CVE.
The privileged init wrapper and unprivileged PoC are available on
request.
This was found with a multi-agent workflow; the full
quota/ring sequence was reproduced in QEMU.
Thanks,
Cheng Yongkang
reply other threads:[~2026-10-22 9:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261022091748.3653127-1-teel4res@gmail.com \
--to=teel4res@gmail.com \
--cc=bcrl@kvack.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®