From: Jens Axboe <axboe@kernel.dk>
To: io-uring <io-uring@vger.kernel.org>,
Pavel Begunkov <asml.silence@gmail.com>
Subject: [PATCH] io_uring/register: use correct location for io_rings_layout
Date: Tue, 18 Nov 2025 19:36:29 -0700 [thread overview]
Message-ID: <64459921-de76-4e5c-8f2b-52e63461d3d4@kernel.dk> (raw)
A previous consolidated the ring size etc calculations into
io_prepare_config(), but missed updating io_register_resize_rings()
correctly to use the calculated values. As a result, it ended up using
on-stack uninitialized values, and hence either failed validating the
size correctly, or just failed resizing because the sizes were random.
This caused failures in the liburing regression tests:
[...]
Running test resize-rings.t
resize=-7
test_basic 3000 failed
Test resize-rings.t failed with ret 1
Running test resize-rings.t /dev/sda
resize=-7
test_basic 3000 failed
Test resize-rings.t failed with ret 1
Running test resize-rings.t /dev/nvme1n1
resize=-7
test_basic 3000 failed
Test resize-rings.t failed with ret 1
Running test resize-rings.t /dev/dm-0
resize=-7
test_basic 3000 failed
Test resize-rings.t failed with ret 1
because io_create_region() would return -E2BIG because of unintialized
reg->size values.
Adjust the struct io_rings_layout rl pointer to point to the correct
location, and remove the (now dead) __rl on stack struct.
Fixes: eb76ff6a6829 ("io_uring: pre-calculate scq layout")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
diff --git a/io_uring/register.c b/io_uring/register.c
index fc66a5364483..db42f98562c4 100644
--- a/io_uring/register.c
+++ b/io_uring/register.c
@@ -403,7 +403,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
struct io_ring_ctx_rings o = { }, n = { }, *to_free = NULL;
unsigned i, tail, old_head;
struct io_uring_params *p = &config.p;
- struct io_rings_layout __rl, *rl = &__rl;
+ struct io_rings_layout *rl = &config.layout;
int ret;
memset(&config, 0, sizeof(config));
--
Jens Axboe
next reply other threads:[~2025-11-19 2:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 2:36 Jens Axboe [this message]
2025-11-19 17:18 ` [PATCH] io_uring/register: use correct location for io_rings_layout Pavel Begunkov
2025-11-19 20:22 ` Jens Axboe
2025-11-21 13:49 ` Pavel Begunkov
2025-11-21 13:59 ` Jens Axboe
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=64459921-de76-4e5c-8f2b-52e63461d3d4@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=io-uring@vger.kernel.org \
/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