From: Jens Axboe <axboe@kernel.dk>
To: Keith Busch <kbusch@kernel.org>,
Michael Bommarito <michael.bommarito@gmail.com>
Cc: io-uring@vger.kernel.org, Pavel Begunkov <asml.silence@gmail.com>,
Li Zetao <lizetao1@huawei.com>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] io_uring: propagate array_index_nospec opcode into req->opcode
Date: Fri, 15 May 2026 09:47:26 -0600 [thread overview]
Message-ID: <cac7db8a-a547-42d0-8589-c8a282cb6860@kernel.dk> (raw)
In-Reply-To: <agc_m0rN3MN7ttAY@kbusch-mbp>
On 5/15/26 9:45 AM, Keith Busch wrote:
> On Fri, May 15, 2026 at 10:58:11AM -0400, Michael Bommarito wrote:
>> The compiled change is one instruction (a single mov of the clamped
>> byte to req->opcode); the cmp/sbb/and clamp triplet is unchanged.
>> No functional change: array_index_nospec() is a no-op for opcodes in
>> [0, IORING_OP_LAST), and out-of-range opcodes are still rejected at
>> the bounds check above this assignment.
>
> Since the bounds check above already catches an invalid opcode, why does
> it need to be re-initialized to the clamped value? Surely it's already
> the same value if we've taken this path, no?
It's to avoid speculation values being used. If the ->opcode store is
the last one, then it doesn't exist.
It's pretty narrow and mostly theoretical, but does make sense.
--
Jens Axboe
next prev parent reply other threads:[~2026-05-15 15:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 14:58 [PATCH] io_uring: propagate array_index_nospec opcode into req->opcode Michael Bommarito
2026-05-15 15:45 ` Keith Busch
2026-05-15 15:47 ` Jens Axboe [this message]
2026-05-15 15:46 ` Jens Axboe
2026-05-16 19:05 ` Jens Axboe
2026-05-16 19:06 ` 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=cac7db8a-a547-42d0-8589-c8a282cb6860@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=io-uring@vger.kernel.org \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizetao1@huawei.com \
--cc=michael.bommarito@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.