Skip to content

Commit 4832427

Browse files
isilenceaxboe
authored andcommitted
io_uring: prevent speculating sq_array indexing
The SQ index array consists of user provided indexes, which io_uring then uses to index the SQ, and so it's susceptible to speculation. For all other queues io_uring tracks heads and tails in kernel, and they shouldn't need any special care. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/c6c7a25962924a55869e317e4fdb682dfdc6b279.1730687889.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent b6f58a3 commit 4832427

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

io_uring/io_uring.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,7 @@ static bool io_get_sqe(struct io_ring_ctx *ctx, const struct io_uring_sqe **sqe)
22452245
READ_ONCE(ctx->rings->sq_dropped) + 1);
22462246
return false;
22472247
}
2248+
head = array_index_nospec(head, ctx->sq_entries);
22482249
}
22492250

22502251
/*

0 commit comments

Comments
 (0)