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: <1DDEC6DE-C54A-4267-8F99-462552B41786@nutanix.com>
Date: Thu, 8 May 2025 02:56:24 +0000
From: Jon Kohler <jon@...anix.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
CC: 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>,
        Paolo Abeni <pabeni@...hat.com>, Alexei
 Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Jesper
 Dangaard Brouer <hawk@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>
Subject: Re: [PATCH net-next] tun: use xdp_get_frame_len()



> On May 7, 2025, at 4:56 PM, Willem de Bruijn <willemdebruijn.kernel@...il.com> wrote:
> 
> !-------------------------------------------------------------------|
>  CAUTION: External Email
> 
> |-------------------------------------------------------------------!
> 
> Jon Kohler wrote:
>> Use xdp_get_frame_len helper to ensure xdp frame size is calculated
>> correctly in both single buffer and multi buffer configurations.
> 
> Not necessarily opposed, but multi buffer is not actually possible
> in this code path, right?
> 
> tun_put_user_xdp only copies xdp_frame->data, for one.
> 
> Else this would also be fix, not net-next material.

Correct, this is a prep patch for future multi buffer support,
I’m not aware of any path that can currently do that thru
this code.

The reason for pursuing multi-buffer is to allow vhost/net
batching to work again for large payloads.

>> 
>> Signed-off-by: Jon Kohler <jon@...anix.com>
>> ---
>> drivers/net/tun.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
>> index 7babd1e9a378..1c879467e696 100644
>> --- a/drivers/net/tun.c
>> +++ b/drivers/net/tun.c
>> @@ -1993,7 +1993,7 @@ static ssize_t tun_put_user_xdp(struct tun_struct *tun,
>> struct iov_iter *iter)
>> {
>> int vnet_hdr_sz = 0;
>> - size_t size = xdp_frame->len;
>> + size_t size = xdp_get_frame_len(xdp_frame);
>> ssize_t ret;
>> 
>> if (tun->flags & IFF_VNET_HDR) {
>> @@ -2579,7 +2579,7 @@ static int tun_ptr_peek_len(void *ptr)
>> if (tun_is_xdp_frame(ptr)) {
>> struct xdp_frame *xdpf = tun_ptr_to_xdp(ptr);
>> 
>> - return xdpf->len;
>> + return xdp_get_frame_len(xdpf);
>> }
>> return __skb_array_len_with_tag(ptr);
>> } else {
>> -- 
>> 2.43.0
>> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ