From: Ming Lei <[email protected]>
To: Gabriel Krisman Bertazi <[email protected]>
Cc: Jens Axboe <[email protected]>,
[email protected],
Harris James R <[email protected]>,
[email protected], [email protected],
ZiyangZhang <[email protected]>,
Xiaoguang Wang <[email protected]>,
Stefan Hajnoczi <[email protected]>
Subject: Re: [PATCH V3 1/1] ublk: add io_uring based userspace block driver
Date: Thu, 7 Jul 2022 15:58:23 +0800 [thread overview]
Message-ID: <YsaSHwQDndyhfZaf@T590> (raw)
In-Reply-To: <YsaQIGbyRKLAOoqR@T590>
On Thu, Jul 07, 2022 at 03:49:52PM +0800, Ming Lei wrote:
> On Tue, Jul 05, 2022 at 04:06:16PM +0800, Ming Lei wrote:
> > On Mon, Jul 04, 2022 at 06:10:40PM -0400, Gabriel Krisman Bertazi wrote:
> > > Ming Lei <[email protected]> writes:
>
> ...
> >
> > >
> > >
> > > > + __func__, cmd->cmd_op, ub_cmd->q_id, tag,
> > > > + ub_cmd->result);
> > > > +
> > > > + if (!(issue_flags & IO_URING_F_SQE128))
> > > > + goto out;
> > > > +
> > > > + ubq = ublk_get_queue(ub, ub_cmd->q_id);
> > > > + if (!ubq || ub_cmd->q_id != ubq->q_id)
> > >
> > > q_id is coming from userspace and is used to access an array inside
> > > ublk_get_queue(). I think you need to ensure qid < ub->dev_info.nr_hw_queues
> > > before calling ublk_get_queue() to protect from a kernel bad memory
> > > access triggered by userspace.
> >
> > Good catch!
>
> Turns out the check on 'qid < ub->dev_info.nr_hw_queues' isn't needed,
> since the condition of 'ub_cmd->q_id != ubq->q_id' is more strict.
But ubq is retrieved via ->q_id, so we do need the validation.
Sorry for the noise.
Thanks,
Ming
prev parent reply other threads:[~2022-07-07 7:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 16:08 [PATCH V3 0/1] ublk: add io_uring based userspace block driver Ming Lei
2022-06-28 16:08 ` [PATCH V3 1/1] " Ming Lei
2022-06-30 11:35 ` Ziyang Zhang
2022-06-30 12:33 ` Ming Lei
2022-07-01 2:47 ` Ziyang Zhang
2022-07-01 4:06 ` Ming Lei
2022-07-04 11:17 ` Sagi Grimberg
2022-07-04 12:34 ` Ming Lei
2022-07-04 14:00 ` Sagi Grimberg
2022-07-04 16:13 ` Gabriel Krisman Bertazi
2022-07-04 16:19 ` Sagi Grimberg
2022-07-05 0:43 ` Ming Lei
2022-07-04 22:10 ` Gabriel Krisman Bertazi
2022-07-05 4:16 ` Ziyang Zhang
2022-07-05 8:12 ` Ming Lei
2022-07-05 8:06 ` Ming Lei
2022-07-07 7:49 ` Ming Lei
2022-07-07 7:58 ` Ming Lei [this message]
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=YsaSHwQDndyhfZaf@T590 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox