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] [thread-next>] [day] [month] [year] [list]
Message-ID: <0aa1055e-3e52-4275-a074-e6f27115a748@redhat.com>
Date: Thu, 19 Jun 2025 19:41:55 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Akihiko Odaki <akihiko.odaki@...nix.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 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.

/P


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ