lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aXzUoRgvbE0izVVP@fedora>
Date: Fri, 30 Jan 2026 23:56:17 +0800
From: Ming Lei <ming.lei@...hat.com>
To: Caleb Sander Mateos <csander@...estorage.com>
Cc: Jens Axboe <axboe@...nel.dk>,
	Govindarajulu Varadarajan <govind.varadar@...il.com>,
	linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] ublk: use READ_ONCE() to read struct ublksrv_ctrl_cmd

On Thu, Jan 29, 2026 at 03:46:16PM -0700, Caleb Sander Mateos wrote:
> struct ublksrv_ctrl_cmd is part of the io_uring_sqe, which may lie in
> userspace-mapped memory. It's racy to access its fields with normal
> loads, as userspace may write to them concurrently. Use READ_ONCE() for
> all the ublksrv_ctrl_cmd field accesses to avoid the race.
> 
> Fixes: 87213b0d847c ("ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK issue")
> Signed-off-by: Caleb Sander Mateos <csander@...estorage.com>
> ---
>  drivers/block/ublk_drv.c | 77 +++++++++++++++++++---------------------
>  1 file changed, 37 insertions(+), 40 deletions(-)

I'd suggest to define local `struct ublksrv_ctrl_cmd` variable in
ublk_ctrl_uring_cmd() for avoiding READ_ONCE:

- it is slow control cod path

- READ_ONCE is supposed to be used for fast path and be carefully

- it is sync command

Defining one local data can be simpler to avoid the issue, and more
reliable.


Thanks,
Ming


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ