* [PATCH 1/1] io_uring: prevent opcode speculation
@ 2025-02-14 22:48 Pavel Begunkov
2025-02-15 4:39 ` lizetao
2025-02-15 15:15 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Pavel Begunkov @ 2025-02-14 22:48 UTC (permalink / raw)
To: io-uring; +Cc: asml.silence
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH 1/1] io_uring: prevent opcode speculation
2025-02-14 22:48 [PATCH 1/1] io_uring: prevent opcode speculation Pavel Begunkov
@ 2025-02-15 4:39 ` lizetao
2025-02-15 15:15 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: lizetao @ 2025-02-15 4:39 UTC (permalink / raw)
To: Pavel Begunkov; +Cc: [email protected], Jens Axboe
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] io_uring: prevent opcode speculation
2025-02-14 22:48 [PATCH 1/1] io_uring: prevent opcode speculation Pavel Begunkov
2025-02-15 4:39 ` lizetao
@ 2025-02-15 15:15 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-02-15 15:15 UTC (permalink / raw)
To: io-uring, Pavel Begunkov
On Fri, 14 Feb 2025 22:48:15 +0000, Pavel Begunkov wrote:
> sqe->opcode is used for different tables, make sure we santitise it
> against speculations.
>
>
Applied, thanks!
[1/1] io_uring: prevent opcode speculation
commit: 1e988c3fe1264708f4f92109203ac5b1d65de50b
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-15 15:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14 22:48 [PATCH 1/1] io_uring: prevent opcode speculation Pavel Begunkov
2025-02-15 4:39 ` lizetao
2025-02-15 15:15 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox