[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACycT3spqEvPP0X9xNd3USm6DVt9JBSyiukzikpiwqQpNRfhzA@mail.gmail.com>
Date: Tue, 18 May 2021 20:28:07 +0800
From: Yongji Xie <xieyongji@...edance.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Jason Wang <jasowang@...hat.com>,
Stefan Hajnoczi <stefanha@...hat.com>, amit@...nel.org,
arei.gonglei@...wei.com, airlied@...ux.ie, kraxel@...hat.com,
dan.j.williams@...el.com,
Johannes Berg <johannes@...solutions.net>,
Ohad Ben Cohen <ohad@...ery.com>, bjorn.andersson@...aro.org,
David Hildenbrand <david@...hat.com>, vgoyal@...hat.com,
miklos@...redi.hu, Stefano Garzarella <sgarzare@...hat.com>,
virtualization <virtualization@...ts.linux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: Re: Re: [RFC PATCH 00/17] Add validation for used length
On Tue, May 18, 2021 at 5:52 PM Michael S. Tsirkin <mst@...hat.com> wrote:
>
> 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@...hat.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.
>
It's fine with me.
Thanks,
Yongji
Powered by blists - more mailing lists