[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4bf7e5d1-4e66-496d-a503-5dc349efe398@kernel.dk>
Date: Wed, 22 Jan 2025 17:18:22 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Pavel Begunkov <asml.silence@...il.com>, Jann Horn <jannh@...gle.com>
Cc: io-uring@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] io_uring/uring_cmd: add missing READ_ONCE() on shared
memory read
On 1/22/25 12:38 PM, Jens Axboe wrote:
>
> On Tue, 21 Jan 2025 17:09:59 +0100, Jann Horn wrote:
>> cmd->sqe seems to point to shared memory here; so values should only be
>> read from it with READ_ONCE(). To ensure that the compiler won't generate
>> code that assumes the value in memory will stay constant, add a
>> READ_ONCE().
>> The callees io_uring_cmd_getsockopt() and io_uring_cmd_setsockopt() already
>> do this correctly.
>>
>> [...]
>
> Applied, thanks!
>
> [1/1] io_uring/uring_cmd: add missing READ_ONCE() on shared memory read
> commit: 0963dba3dc006b454c54fd019bbbdb931e7a7c70
I took a closer look and this isn't necessary. Either ->sqe is a full
copy at this point. Should probably be renamed as such... If we want to
make this clearer, then we should do:
- switch (cmd->sqe->cmd_op) {
+ switch (cmd->cmd_op) {
instead.
I'll drop this one.
--
Jens Axboe
Powered by blists - more mailing lists