Skip to content

Commit d197b82

Browse files
isilenceopsiff
authored andcommitted
io_uring: prevent opcode speculation
commit 1e988c3 upstream. sqe->opcode is used for different tables, make sure we santitise it against speculations. Cc: stable@vger.kernel.org Fixes: d365634 ("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> (cherry picked from commit b9826e3)
1 parent fa9637f commit d197b82

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

io_uring/io_uring.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,8 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
21762176
req->opcode = 0;
21772177
return io_init_fail_req(req, -EINVAL);
21782178
}
2179+
opcode = array_index_nospec(opcode, IORING_OP_LAST);
2180+
21792181
def = &io_issue_defs[opcode];
21802182
if (unlikely(sqe_flags & ~SQE_COMMON_FLAGS)) {
21812183
/* enforce forwards compatibility on users */

0 commit comments

Comments
 (0)