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: <CACGkMEu6r66Jg3--eOCyMdd1WqKeP9Jvfv+DFmWk07oTJUKZyQ@mail.gmail.com>
Date: Mon, 30 Jun 2025 11:36:56 +0800
From: Jason Wang <jasowang@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: willemdebruijn.kernel@...il.com, andrew+netdev@...n.ch, 
	davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com, mst@...hat.com, 
	eperezma@...hat.com, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, 
	kvm@...r.kernel.org, virtualization@...ts.linux.dev, 
	Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH V2 net-next 2/2] vhost-net: reduce one userspace copy when
 building XDP buff

On Sat, Jun 28, 2025 at 8:48 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Thu, 26 Jun 2025 10:14:45 +0800 Jason Wang wrote:
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -690,13 +690,13 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
> >       if (unlikely(!buf))
> >               return -ENOMEM;
> >
> > -     copied = copy_from_iter(buf, sock_hlen, from);
> > -     if (copied != sock_hlen) {
> > +     copied = copy_from_iter(buf + pad - sock_hlen, len, from);
> > +     if (copied != len) {
> >               ret = -EFAULT;
> >               goto err;
> >       }
> >
> > -     gso = buf;
> > +     gso = buf + pad - sock_hlen;
> >
> >       if (!sock_hlen)
> >               memset(buf, 0, pad);
> > @@ -715,12 +715,8 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
> >               }
> >       }
> >
> > -     len -= sock_hlen;
>
> we used to adjust @len here, now we don't..
>
> > -     copied = copy_from_iter(buf + pad, len, from);
> > -     if (copied != len) {
> > -             ret = -EFAULT;
> > -             goto err;
> > -     }
> > +     /* pad contains sock_hlen */
> > +     memcpy(buf, buf + pad - sock_hlen, sock_hlen);
> >
> >       xdp_init_buff(xdp, buflen, NULL);
> >       xdp_prepare_buff(xdp, buf, pad, len, true);
>
> .. yet we still use len as the packet size here.

Exactly, it should be len - sock_hlen here.

Thanks

> --
> pw-bot: cr
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ