[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b339549d-c8f1-1e56-2759-f7b15ee8eca1@redhat.com>
Date: Fri, 25 Jun 2021 15:33:36 +0800
From: Jason Wang <jasowang@...hat.com>
To: David Woodhouse <dwmw2@...radead.org>, netdev@...r.kernel.org
Cc: Eugenio Pérez <eperezma@...hat.com>,
Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH v3 3/5] vhost_net: remove virtio_net_hdr validation, let
tun/tap do it themselves
在 2021/6/24 下午8:30, David Woodhouse 写道:
> From: David Woodhouse<dwmw@...zon.co.uk>
>
> When the underlying socket isn't configured with a virtio_net_hdr, the
> existing code in vhost_net_build_xdp() would attempt to validate
> uninitialised data, by copying zero bytes (sock_hlen) into the local
> copy of the header and then trying to validate that.
>
> Fixing it is somewhat non-trivial because the tun device might put a
> struct tun_pi*before* the virtio_net_hdr, which makes it hard to find.
> So just stop messing with someone else's data in vhost_net_build_xdp(),
> and let tap and tun validate it for themselves, as they do in the
> non-XDP case anyway.
Thinking in another way. All XDP stuffs for vhost is prepared for TAP.
XDP is not expected to work for TUN.
So we can simply let's vhost doesn't go with XDP path is the underlayer
socket is TUN.
Thanks
>
> This means that the 'gso' member of struct tun_xdp_hdr can die, leaving
> only 'int buflen'.
>
> The socket header of sock_hlen is still copied separately from the
> data payload because there may be a gap between them to ensure suitable
> alignment of the latter.
>
> Fixes: 0a0be13b8fe2 ("vhost_net: batch submitting XDP buffers to underlayer sockets")
> Signed-off-by: David Woodhouse<dwmw@...zon.co.uk>
> ---
> drivers/net/tap.c | 25 ++++++++++++++++++++++---
> drivers/net/tun.c | 21 ++++++++++++++++++---
> drivers/vhost/net.c | 30 +++++++++---------------------
> include/linux/if_tun.h | 1 -
> 4 files changed, 49 insertions(+), 28 deletions(-)
Powered by blists - more mailing lists