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: <c513ea1d-cdbb-424c-a204-bc0123ce7e8d@rsg.ci.i.u-tokyo.ac.jp>
Date: Sat, 21 Jun 2025 14:04:32 +0900
From: Akihiko Odaki <odaki@....ci.i.u-tokyo.ac.jp>
To: Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Cc: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
        Jason Wang <jasowang@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
        Eugenio Pérez
 <eperezma@...hat.com>,
        Yuri Benditovich <yuri.benditovich@...nix.com>
Subject: Re: [PATCH v4 net-next 7/8] tun: enable gso over UDP tunnel support.

On 2025/06/20 5:30, Paolo Abeni wrote:
> On 6/19/25 7:41 PM, Paolo Abeni wrote:
>> On 6/19/25 6:02 PM, Akihiko Odaki wrote:
>>> On 2025/06/18 1:12, Paolo Abeni wrote:
>>>> @@ -2426,7 +2453,17 @@ static int tun_xdp_one(struct tun_struct *tun,
>>>>    	if (metasize > 0)
>>>>    		skb_metadata_set(skb, metasize);
>>>>    
>>>> -	if (tun_vnet_hdr_to_skb(tun->flags, skb, gso)) {
>>>> +	/*
>>>> +	 * Assume tunnel offloads are enabled if the received hdr is large
>>>> +	 * enough.
>>>> +	 */
>>>> +	if (READ_ONCE(tun->vnet_hdr_sz) >= TUN_VNET_TNL_SIZE &&
>>>> +	    xdp->data - xdp->data_hard_start >= TUN_VNET_TNL_SIZE)
>>>> +		features = NETIF_F_GSO_UDP_TUNNEL |
>>>> +			   NETIF_F_GSO_UDP_TUNNEL_CSUM;
>>>
>>> xdp->data - xdp->data_hard_start may not represent the header size.
>>>
>>> struct tun_xdp_hdr is filled in vhost_net_build_xdp() in
>>> drivers/vhost/net.c. This function sets the two fields with
>>> xdp_prepare_buff(), but the arguments passed to xdp_prepare_buff() does
>>> not seem to represent the exact size of the header.
>>
>> Indeed the xdp->data - xdp->data_hard_start range additionally contains
>> some padding and eventually the xdp specific headroom. The problem is
>> that both info are vhost_net specific and tun can't (or at least shoul)
>> not be aware of them.
>>
>> The only IMHO feasible refinement could be using xdp->data_meta instead
>> of xdp->data when available. Alternatively I could drop entirely the test.

struct tun_xdp_hdr can be extended to contain struct 
virtio_net_hdr_v1_hash_tunnel.

> 
> As the vhost_net padding is considerably larger than the largest
> possible vnet_hdr_sz, I'll drop entirely the xdp check - so that I can
> use the newly introduced tun_vnet_hdr_guest_features() helper here, too.

I think dropping the XDP check is the best option (and leaving struct 
tun_xdp_hdr as is) until vhost_net_build_xdp() gains the UDP tunnel support.

Regards,
Akihiko Odaki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ