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]
Date:   Sun, 30 Apr 2023 11:41:32 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Eric Dumazet' <edumazet@...gle.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "eric.dumazet@...il.com" <eric.dumazet@...il.com>,
        David Ahern <dsahern@...nel.org>,
        Xin Long <lucien.xin@...il.com>,
        Willem de Bruijn <willemb@...gle.com>,
        Coco Li <lixiaoyan@...gle.com>
Subject: RE: [PATCH v2 net] tcp: fix skb_copy_ubufs() vs BIG TCP

From: Eric Dumazet
> Sent: 28 April 2023 05:33
...
> -	new_frags = (__skb_pagelen(skb) + PAGE_SIZE - 1) >> PAGE_SHIFT;
> +	/* We might have to allocate high order pages, so compute what minimum
> +	 * page order is needed.
> +	 */
> +	order = 0;
> +	while ((PAGE_SIZE << order) * MAX_SKB_FRAGS < __skb_pagelen(skb))
> +		order++;
> +	psize = (PAGE_SIZE << order);
> +
> +	new_frags = (__skb_pagelen(skb) + psize - 1) >> (PAGE_SHIFT + order);

That looks like it will generate quite horrid code.
Perhaps something like:

	new_frags = (__skb_pagelen(skb) + PAGE_SIZE - 1) >> PAGE_SHIFT;
	order = 0;
	psize = PAGE_SIZE;
	if (new_frags > MAX_SKB_FRAGS) {
		/* Allocate high order pages to reduce the number of frags. */
		order = ilog2(DIV_ROUNDUP(new_frags, MAX_SKB_FRAGS) - 1) + 1;
		psize <<= order;
	}

There might be an 'off-by-one' in there somewhere though...

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ