OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>,
	khorenko@virtuozzo.com, vladimir.riabchun@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers
Date: Tue, 1 Dec 2026 01:21:13 +0000	[thread overview]
Message-ID: <010701a22f310e23-cc84ca07-0367-4791-b9ce-035f7d8fb7f3-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261130184822.2743885-4-eva.kurchatova@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] sch_cake: cake_ack_filter() passes tail skb to
  ipv6_payload_len() for queued skb header
- [Low] ipv6: payload_len helper changes trim behaviour for GSO TCP
  skbs, contrary to 'no behavioral change'
--

commit 4ea80ca90ac26540568220de28fd73c759be5f1a
Author: Alice Mikityanska <alice@isovalent.com>

ms/net/ipv6: Introduce payload_len helpers

This adds ipv6_payload_len(), skb_ipv6_payload_len() and ipv6_set_payload_len(). They wrap ip6->payload_len, and fall back to a length computed from skb->len when payload_len is zero. The commit converts the IPv6 paths that can see BIG TCP packets to use them.

Link: https://patch.msgid.link/20260205133925.526371-2-alice.kernel@fastmail.im

> diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
> index a6e2aadbb91bd..d960b887469d0 100644
> --- a/include/linux/ipv6.h
> +++ b/include/linux/ipv6.h
> @@ -125,6 +125,28 @@ static inline unsigned int ipv6_transport_len(const struct sk_buff *skb)
>  	       skb_network_header_len(skb);
>  }
>  
> +static inline unsigned int
> +ipv6_payload_len(const struct sk_buff *skb, const struct ipv6hdr *ip6)
> +{
> +	u32 len = ntohs(ip6->payload_len);
> +
> +	return (len || !skb_is_gso(skb) || !skb_is_gso_tcp(skb)) ?
> +		len :
> +		skb->len - skb_network_offset(skb) - sizeof(struct ipv6hdr);
> +}
> +

[ ... ]

> diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
> index 0b3b81fd4a58a..9c2be98b961ad 100644
> --- a/net/ipv6/ip6_input.c
> +++ b/net/ipv6/ip6_input.c
> @@ -262,7 +262,7 @@ static struct sk_buff *ip6_rcv_core(struct sk_buff *skb, struct net_device *dev,
>  	skb->transport_header = skb->network_header + sizeof(*hdr);
>  	IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
>  
> -	pkt_len = ntohs(hdr->payload_len);
> +	pkt_len = ipv6_payload_len(skb, hdr);
>  
>  	/* pkt_len may be zero if Jumbo payload option is present */
>  	if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) {

[Severity: Low]
Is the "No behavioral change" statement in the commit message accurate?

ipv6_payload_len() falls back to skb->len for any GSO TCP skb with payload_len == 0. It does not require a hop-by-hop jumbo header. Take a GSO TCPv6 skb with payload_len == 0 and nexthdr != NEXTHDR_HOP, for example one injected by a tap or virtio sender. Before the patch, ip6_rcv_core() saw pkt_len == 0 and trimmed the skb to the bare IPv6 header. Now pkt_len is skb->len minus the header, so no trim happens and the skb keeps its full length. br_validate_ipv6() and the other converted callers change in the same way.

Could the commit message describe this change, or could the helper be restricted to the cases the series targets?

[ ... ]

> diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
> index 8db48f8ec81fb..4db9ffb00abd8 100644
> --- a/net/sched/sch_cake.c
> +++ b/net/sched/sch_cake.c
> @@ -1266,7 +1266,7 @@ static struct sk_buff *cake_ack_filter(struct cake_sched_data *q,
>  			    ipv6_addr_cmp(&ipv6h_check->daddr, &ipv6h->daddr))
>  				continue;
>  
> -			seglen = ntohs(ipv6h_check->payload_len);
> +			seglen = ipv6_payload_len(skb, ipv6h_check);
>  		} else {
>  			WARN_ON(1);  /* shouldn't happen */
>  			continue;

[Severity: Low]
Does this read the length from the wrong skb? ipv6h_check is the header of skb_check, but skb is the triggering tail skb.

Take a queued BIG TCP GSO skb with payload_len == 0 when ack-filter is on and split-gso is off. The fallback then uses skb->len and skb_network_offset() of the tail. Suppose the tail is a small pure ACK of the same 5-tuple. Then seglen ends up equal to the tail's TCP header length, so the later (seglen - __tcp_hdrlen(tcph_check)) != 0 test can pass. The queued data skb may then be treated as a pure ACK and dropped, forcing a retransmit. Before the patch, seglen was 0 for such a skb, so it was never eligible.

Should this pass skb_check instead of skb? The IPv4 line next to it, iph_totlen(skb, iph_check), has the same mismatch. This patch did not introduce it.

Carry the trailer below into the next revision and Sashiko will not review this patch again.

Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261130184822.2743885-1-eva.kurchatova@virtuozzo.com?part=3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-12-01  1:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 18:45 [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 1/8] ms/tcp: clear sock_ops cb flags before force-closing a child socket Eva Kurchatova
2026-12-01  1:17   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 2/8] ms/tcp: Skip cond_resched() in inet_csk_listen_stop() under BPF context Eva Kurchatova
2026-12-01  1:18   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 3/8] ms/net/ipv6: Introduce payload_len helpers Eva Kurchatova
2026-12-01  1:21   ` no-reply [this message]
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 4/8] ms/calipso: keep BIG TCP payload_len in calipso_skbuff_setattr() Eva Kurchatova
2026-12-01  1:22   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 5/8] ms/calipso: hash the cache key, not the option start, in calipso_cache_add() Eva Kurchatova
2026-12-01  1:23   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 6/8] ms/calipso: update payload_len when removing the CALIPSO option Eva Kurchatova
2026-12-01  1:25   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 7/8] ms/tcp: fix NULL pointer dereference when restarting a Fast Open listener Eva Kurchatova
2026-12-01  1:25   ` no-reply
2026-11-30 18:45 ` [Devel] [PATCH hci-8.2 8/8] ms/tcp: purge Fast Open RST queue when listen() fails Eva Kurchatova
2026-12-01  1:28   ` no-reply
2026-12-01 11:37 ` [Devel] [PATCH hci-8.2 0/8] ms: backport additional TFO and CALIPSO fixes Eva Kurchatova (Virtuozzo)
2026-12-01 15:42 ` Eva Kurchatova (Virtuozzo)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=010701a22f310e23-cc84ca07-0367-4791-b9ce-035f7d8fb7f3-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=eva.kurchatova@virtuozzo.com \
    --cc=khorenko@virtuozzo.com \
    --cc=vladimir.riabchun@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox