From: Gabriel Krisman Bertazi <[email protected]>
To: [email protected]
Cc: [email protected], Gabriel Krisman Bertazi <[email protected]>
Subject: [PATCH 1/3] io_uring: Fix probe of disabled operations
Date: Tue, 18 Jun 2024 22:06:18 -0400 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
io_probe checks io_issue_def->not_supported, but we never really set
that field, as we mark non-supported functions through a specific ->prep
handler. This means we end up returning IO_URING_OP_SUPPORTED, even for
disabled operations. Fix it by just checking the prep handler itself.
Fixes: 66f4af93da57 ("io_uring: add support for probing opcodes")
Signed-off-by: Gabriel Krisman Bertazi <[email protected]>
---
io_uring/opdef.c | 8 ++++++++
io_uring/opdef.h | 4 ++--
io_uring/register.c | 2 +-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/io_uring/opdef.c b/io_uring/opdef.c
index 7d5c51fb8e6e..f3af2126fc7d 100644
--- a/io_uring/opdef.c
+++ b/io_uring/opdef.c
@@ -746,6 +746,14 @@ const char *io_uring_get_opcode(u8 opcode)
return "INVALID";
}
+bool io_uring_op_supported(u8 opcode)
+{
+ if (opcode < IORING_OP_LAST &&
+ io_issue_defs[opcode].prep != io_eopnotsupp_prep)
+ return true;
+ return false;
+}
+
void __init io_uring_optable_init(void)
{
int i;
diff --git a/io_uring/opdef.h b/io_uring/opdef.h
index 7ee6f5aa90aa..14456436ff74 100644
--- a/io_uring/opdef.h
+++ b/io_uring/opdef.h
@@ -17,8 +17,6 @@ struct io_issue_def {
unsigned poll_exclusive : 1;
/* op supports buffer selection */
unsigned buffer_select : 1;
- /* opcode is not supported by this kernel */
- unsigned not_supported : 1;
/* skip auditing */
unsigned audit_skip : 1;
/* supports ioprio */
@@ -47,5 +45,7 @@ struct io_cold_def {
extern const struct io_issue_def io_issue_defs[];
extern const struct io_cold_def io_cold_defs[];
+bool io_uring_op_supported(u8 opcode);
+
void io_uring_optable_init(void);
#endif
diff --git a/io_uring/register.c b/io_uring/register.c
index 50e9cbf85f7d..75f8e85cf0b0 100644
--- a/io_uring/register.c
+++ b/io_uring/register.c
@@ -59,7 +59,7 @@ static __cold int io_probe(struct io_ring_ctx *ctx, void __user *arg,
for (i = 0; i < nr_args; i++) {
p->ops[i].op = i;
- if (!io_issue_defs[i].not_supported)
+ if (io_uring_op_supported(i))
p->ops[i].flags = IO_URING_OP_SUPPORTED;
}
p->ops_len = i;
--
2.45.2
next prev parent reply other threads:[~2024-06-19 2:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 2:06 [PATCH 0/3] io_uring op probing fixes Gabriel Krisman Bertazi
2024-06-19 2:06 ` Gabriel Krisman Bertazi [this message]
2024-06-19 2:06 ` [PATCH 2/3] io_uring: Allocate only necessary memory in io_probe Gabriel Krisman Bertazi
2024-06-19 2:06 ` [PATCH 3/3] io_uring: Don't read userspace data " Gabriel Krisman Bertazi
2024-06-19 13:44 ` Jens Axboe
2024-06-19 14:55 ` Gabriel Krisman Bertazi
2024-06-19 14:57 ` Jens Axboe
2024-06-19 13:42 ` [PATCH 0/3] io_uring op probing fixes Jens Axboe
2024-06-19 14:58 ` (subset) " 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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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