]> www.infradead.org Git - users/hch/misc.git/commit
io_uring/register: use stable SQ/CQ ring data during resize
authorJens Axboe <axboe@kernel.dk>
Wed, 15 Jan 2025 14:39:12 +0000 (07:39 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 15 Jan 2025 14:45:47 +0000 (07:45 -0700)
commit8911798d3e8a9624b1acf2882c7a0183694d714d
tree62fbcec8da11210e3cd94596df5531630e38ae08
parentc1c03ee7957ec178756cae09c39d77194e8cddb7
io_uring/register: use stable SQ/CQ ring data during resize

Normally the kernel would not expect an application to modify any of
the data shared with the kernel during a resize operation, but of
course the kernel cannot always assume good intent on behalf of the
application.

As part of resizing the rings, existing SQEs and CQEs are copied over
to the new storage. Resizing uses the masks in the newly allocated
shared storage to index the arrays, however it's possible that malicious
userspace could modify these after they have been sanity checked.

Use the validated and locally stored CQ and SQ ring sizing for masking
to ensure the values are both stable and valid.

Fixes: 79cfe9e59c2a ("io_uring/register: add IORING_REGISTER_RESIZE_RINGS")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/register.c