summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2025-02-14 22:48:15 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-27 04:10:51 -0800
commitb9826e3b26ec031e9063f64a7c735449c43955e4 (patch)
tree67631556a09a5e3d9dab2311e1d7bffca11ae3db /io_uring
parentf16a74c5f2471597475ededcf6553dc5f69d8b69 (diff)
downloadlinux-b9826e3b26ec031e9063f64a7c735449c43955e4.tar.gz
linux-b9826e3b26ec031e9063f64a7c735449c43955e4.tar.bz2
linux-b9826e3b26ec031e9063f64a7c735449c43955e4.zip
io_uring: prevent opcode speculation
commit 1e988c3fe1264708f4f92109203ac5b1d65de50b upstream. sqe->opcode is used for different tables, make sure we santitise it against speculations. Cc: stable@vger.kernel.org Fixes: d3656344fea03 ("io_uring: add lookup table for various opcode needs") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Reviewed-by: Li Zetao <lizetao1@huawei.com> Link: https://lore.kernel.org/r/7eddbf31c8ca0a3947f8ed98271acc2b4349c016.1739568408.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index b61637dad442..5776440f584c 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2176,6 +2176,8 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
req->opcode = 0;
return io_init_fail_req(req, -EINVAL);
}
+ opcode = array_index_nospec(opcode, IORING_OP_LAST);
+
def = &io_issue_defs[opcode];
if (unlikely(sqe_flags & ~SQE_COMMON_FLAGS)) {
/* enforce forwards compatibility on users */