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] [day] [month] [year] [list]
Message-ID: <CACycT3vzpYRpFsBxCo+huG+wGE5TtD_N3A7wZf-yc_+cCfjzyw@mail.gmail.com>
Date:   Tue, 25 May 2021 13:08:29 +0800
From:   Yongji Xie <xieyongji@...edance.com>
To:     Jason Wang <jasowang@...hat.com>
Cc:     "Michael S. Tsirkin" <mst@...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: [RFC PATCH 17/17] virtio_ring: Add validation for used length

On Tue, May 25, 2021 at 9:31 AM Jason Wang <jasowang@...hat.com> wrote:
>
>
> 在 2021/5/18 上午7:39, Michael S. Tsirkin 写道:
> > On Mon, May 17, 2021 at 05:08:36PM +0800, Xie Yongji wrote:
> >> This adds validation for used length (might come
> >> from an untrusted device) when it will be used by
> >> virtio device driver.
> >>
> >> Signed-off-by: Xie Yongji <xieyongji@...edance.com>
> >> ---
> >>   drivers/virtio/virtio_ring.c | 22 +++++++++++++++++++---
> >>   1 file changed, 19 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> >> index d999a1d6d271..7d4845d06f21 100644
> >> --- a/drivers/virtio/virtio_ring.c
> >> +++ b/drivers/virtio/virtio_ring.c
> >> @@ -68,11 +68,13 @@
> >>   struct vring_desc_state_split {
> >>      void *data;                     /* Data for callback. */
> >>      struct vring_desc *indir_desc;  /* Indirect descriptor, if any. */
> >> +    u32 in_len;                     /* Total length of writable buffer */
> >>   };
> >>
> >>   struct vring_desc_state_packed {
> >>      void *data;                     /* Data for callback. */
> >>      struct vring_packed_desc *indir_desc; /* Indirect descriptor, if any. */
> >> +    u32 in_len;                     /* Total length of writable buffer */
> >>      u16 num;                        /* Descriptor list length. */
> >>      u16 last;                       /* The last desc state in a list. */
> >>   };
> >
> > Hmm for packed it's aligned to 64 bit anyway, so we are not making it
> > any worse. But for split this pushes struct size up by 1/3 increasing
> > cache pressure.
>
>
> We can eliminate this by validating through virtio device driver instead
> of virtio core.
>
> E.g for virtio-net we know the rx buffer size so there's no need to
> store in twice in the core.
>

I see. I have sent the new fix just now.

Thanks,
Yongji

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ