[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFj5m9LskF5Gb_iCXBpc0LcJYK1tWQ4mrYntQuf866Mp4EtujA@mail.gmail.com>
Date: Sat, 31 Jan 2026 00:05:33 +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 2/4] ublk: don't write to struct ublksrv_ctrl_cmd
On Fri, Jan 30, 2026 at 11:48 PM Ming Lei <ming.lei@...hat.com> wrote:
>
> On Thu, Jan 29, 2026 at 03:46:15PM -0700, Caleb Sander Mateos wrote:
> > ublk_ctrl_uring_cmd_permission() writes to struct ublksrv_ctrl_cmd's
> > addr and len fields, which is racy because ublksrv_ctrl_cmd is part of
> > the io_uring_sqe, which may lie in userspace-mapped memory. Store the
> > values of addr in len in local variables instead 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>
>
> The simpler approach is to define local `header` variable and copy data to
> it.
Given READ_ONCE() is still needed in patch 3, I'd suggest to fix by adding
local `struct ublksrv_ctrl_cmd` shadow variable in an easy & reliable way.
Thanks,
Powered by blists - more mailing lists