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]
Date: Sun, 10 Mar 2024 06:34:05 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Richard Gobert <richardbgobert@...il.com>, 
 davem@...emloft.net, 
 edumazet@...gle.com, 
 kuba@...nel.org, 
 pabeni@...hat.com, 
 willemdebruijn.kernel@...il.com, 
 dsahern@...nel.org, 
 xeb@...l.ru, 
 shuah@...nel.org, 
 idosch@...dia.com, 
 razor@...ckwall.org, 
 amcohen@...dia.com, 
 petrm@...dia.com, 
 jbenc@...hat.com, 
 bpoirier@...dia.com, 
 b.galvani@...il.com, 
 gavinl@...dia.com, 
 liujian56@...wei.com, 
 horms@...nel.org, 
 linyunsheng@...wei.com, 
 therbert@...gle.com, 
 netdev@...r.kernel.org, 
 linux-kernel@...r.kernel.org, 
 linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net-next v3 4/4] net: gro: move L3 flush checks to
 tcp_gro_receive

Richard Gobert wrote:
> {inet,ipv6}_gro_receive functions perform flush checks (ttl, flags,
> iph->id, ...) against all packets in a loop. These flush checks are
> relevant only to tcp flows, and as such they're used to determine whether
> the packets can be merged later in tcp_gro_receive.
> 
> These checks are not relevant to UDP packets.

These are network protocol coalescing invariants. Why would they be
limited to certain transport protocols only?

> Furthermore, they need to be
> done only once in tcp_gro_receive and only against the found p skb, since
> they only affect flush and not same_flow.
> 
> Levaraging the previous commit in the series, in which correct network
> header offsets are saved for both outer and inner network headers -
> allowing these checks to be done only once, in tcp_gro_receive. As a
> result, NAPI_GRO_CB(p)->flush is not used at all. In addition - flush_id
> checks are more declerative and contained in inet_gro_flush, thus removing

declarative

> the need for flush_id in napi_gro_cb.
> 
> Signed-off-by: Richard Gobert <richardbgobert@...il.com>
> ---
> +static int inet_gro_flush(const struct iphdr *iph, const struct iphdr *iph2,
> +			  struct sk_buff *p, u32 outer)
> +{
> +	const u32 id = ntohl(*(__be32 *)&iph->id);
> +	const u32 id2 = ntohl(*(__be32 *)&iph2->id);
> +	const int flush_id = ntohs(id >> 16) - ntohs(id2 >> 16);
> +	const u16 count = NAPI_GRO_CB(p)->count;
> +	const u32 df = id & IP_DF;
> +	u32 is_atomic;
> +	int flush;
> +
> +	/* All fields must match except length and checksum. */
> +	flush = (iph->ttl ^ iph2->ttl) | (iph->tos ^ iph2->tos) | (df ^ (id2 & IP_DF));
> +
> +	/* When we receive our second frame we can make a decision on if we
> +	 * continue this flow as an atomic flow with a fixed ID or if we use
> +	 * an incremdfenting ID.
> +	 */

Comment became garbled on move: incrementing

> +	if (count == 1) {
> +		is_atomic = df && flush_id == 0;
> +		NAPI_GRO_CB(p)->is_atomic = is_atomic;
> +	} else {
> +		is_atomic = df && NAPI_GRO_CB(p)->is_atomic;
> +	}
> +
> +	/* Ignore outer IP ID value if based on atomic datagram. */
> +	outer = (outer && df) - 1;
> +	is_atomic--;
> +
> +	return flush | ((flush_id ^ (count & is_atomic)) & outer);
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ