From: lizetao <lizetao1@huawei.com>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: "io-uring@vger.kernel.org" <io-uring@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>
Subject: RE: [PATCH 1/1] io_uring: prevent opcode speculation
Date: Sat, 15 Feb 2025 04:39:10 +0000 [thread overview]
Message-ID: <fb0de760ab8c48a79e8e4dadfb10ffcf@huawei.com> (raw)
In-Reply-To: <7eddbf31c8ca0a3947f8ed98271acc2b4349c016.1739568408.git.asml.silence@gmail.com>
Hi,
> -----Original Message-----
> From: Pavel Begunkov <asml.silence@gmail.com>
> Sent: Saturday, February 15, 2025 6:48 AM
> To: io-uring@vger.kernel.org
> Cc: asml.silence@gmail.com
> Subject: [PATCH 1/1] io_uring: prevent opcode speculation
>
> 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>
> ---
> io_uring/io_uring.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index
> 263e504be4a8..29a42365a481 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -2045,6 +2045,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 */
> --
> 2.48.1
>
Reviewed-by: Li Zetao <lizetao1@huawei.com>
---
Li Zetao
next prev parent reply other threads:[~2025-02-15 4:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 22:48 [PATCH 1/1] io_uring: prevent opcode speculation Pavel Begunkov
2025-02-15 4:39 ` lizetao [this message]
2025-02-15 15:15 ` 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=fb0de760ab8c48a79e8e4dadfb10ffcf@huawei.com \
--to=lizetao1@huawei.com \
--cc=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