virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Yongji Xie <xieyongji@bytedance.com>
Cc: Ohad Ben Cohen <ohad@wizery.com>,
	amit@kernel.org, airlied@linux.ie,
	linux-kernel <linux-kernel@vger.kernel.org>,
	bjorn.andersson@linaro.org, miklos@szeredi.hu,
	Stefan Hajnoczi <stefanha@redhat.com>,
	dan.j.williams@intel.com,
	virtualization <virtualization@lists.linux-foundation.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	vgoyal@redhat.com
Subject: Re: Re: [RFC PATCH 00/17] Add validation for used length
Date: Tue, 18 May 2021 05:52:10 -0400	[thread overview]
Message-ID: <20210518055146-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CACycT3uWexPNTiroO5EBT9q8YOorvvVaY_kymapWkLZ078J7aQ@mail.gmail.com>

On Tue, May 18, 2021 at 04:29:44PM +0800, Yongji Xie wrote:
> On Tue, May 18, 2021 at 7:40 AM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Mon, May 17, 2021 at 05:08:19PM +0800, Xie Yongji wrote:
> > > Current virtio device drivers may trust the used length returned
> > > in virtqueue_get_buf()/virtqueue_get_buf_ctx(). But the used length
> > > might come from an untrusted device when VDUSE[1] is enabled. To
> > > protect this case, this series tries to add validation for the
> > > used length.
> > >
> > > Since many legacy devices will also set the used length incorrectly,
> > > we did not add the validation unconditionally. Instead, we will do
> > > the validation only when the device driver needs the used length.
> > > A NULL len passed to virtqueue_get_buf()/virtqueue_get_buf_ctx()
> > > will mean the used length is not needed by the device driver.
> >
> > Can we be more specific? Which drivers have problems when used len
> > is incorrect? Maybe there's an easier way like validating the length
> > in the driver ...
> >
> 
> It's ok to me. But this means all future new drivers need to remember
> to do the validation.
> 
> Now only virtio-net and virtio-console drivers have this problem. I
> can send some patches to fix it.
> 
> Thanks,
> Yongji

I'd say let's just document the requirement for now.

-- 
MST

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

      parent reply	other threads:[~2021-05-18  9:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210517090836.533-1-xieyongji@bytedance.com>
     [not found] ` <20210517090836.533-2-xieyongji@bytedance.com>
2021-05-17  9:11   ` [RFC PATCH 01/17] virtio_ring: Avoid reading unneeded used length Johannes Berg
     [not found] ` <20210517090836.533-18-xieyongji@bytedance.com>
2021-05-17 23:39   ` [RFC PATCH 17/17] virtio_ring: Add validation for " Michael S. Tsirkin
2021-05-25  1:31     ` Jason Wang
2021-05-17 23:40 ` [RFC PATCH 00/17] " Michael S. Tsirkin
     [not found]   ` <CACycT3uWexPNTiroO5EBT9q8YOorvvVaY_kymapWkLZ078J7aQ@mail.gmail.com>
2021-05-18  9:52     ` Michael S. Tsirkin [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=20210518055146-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=airlied@linux.ie \
    --cc=amit@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dan.j.williams@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=ohad@wizery.com \
    --cc=stefanha@redhat.com \
    --cc=vgoyal@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).