public inbox for [email protected]
 help / color / mirror / Atom feed
From: lizetao <[email protected]>
To: Pavel Begunkov <[email protected]>
Cc: "[email protected]" <[email protected]>,
	Jens Axboe <[email protected]>
Subject: RE: [PATCH 1/1] io_uring: prevent opcode speculation
Date: Sat, 15 Feb 2025 04:39:10 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <7eddbf31c8ca0a3947f8ed98271acc2b4349c016.1739568408.git.asml.silence@gmail.com>

Hi,

> -----Original Message-----
> From: Pavel Begunkov <[email protected]>
> Sent: Saturday, February 15, 2025 6:48 AM
> To: [email protected]
> Cc: [email protected]
> Subject: [PATCH 1/1] io_uring: prevent opcode speculation
> 
> sqe->opcode is used for different tables, make sure we santitise it
> against speculations.
> 
> Cc: [email protected]
> Fixes: d3656344fea03 ("io_uring: add lookup table for various opcode needs")
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
>  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 <[email protected]>

---
Li Zetao


  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 \
    [email protected] \
    [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