From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com, axboe@kernel.dk
Subject: [PATCH 1/2] io_uring/query: prevent infinite loops
Date: Fri, 19 Sep 2025 12:11:56 +0100 [thread overview]
Message-ID: <f75507859ac323967db8b7801b82122aca4e2c84.1758278680.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1758278680.git.asml.silence@gmail.com>
If the query chain forms a cycle, the interface will loop indefinitely.
Make sure it handles fatal signals, so the user can kill the process and
hence break out of the infinite loop.
Fixes: c265ae75f900 ("io_uring: introduce io_uring querying")
Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/query.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/io_uring/query.c b/io_uring/query.c
index 9eed0f371956..c2183daf5a46 100644
--- a/io_uring/query.c
+++ b/io_uring/query.c
@@ -88,6 +88,10 @@ int io_query(struct io_ring_ctx *ctx, void __user *arg, unsigned nr_args)
if (ret)
return ret;
uhdr = u64_to_user_ptr(next_hdr);
+
+ if (fatal_signal_pending(current))
+ return -EINTR;
+ cond_resched();
}
return 0;
}
--
2.49.0
next prev parent reply other threads:[~2025-09-19 11:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 11:11 [PATCH 0/2] query infinite loop prevention Pavel Begunkov
2025-09-19 11:11 ` Pavel Begunkov [this message]
2025-09-19 11:11 ` [PATCH 2/2] io_uring/query: cap number of queries Pavel Begunkov
2025-09-19 13:06 ` [PATCH 0/2] query infinite loop prevention 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=f75507859ac323967db8b7801b82122aca4e2c84.1758278680.git.asml.silence@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--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