diff options
| author | Eric Dumazet <edumazet@google.com> | 2026-08-27 06:40:25 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-08-27 14:29:06 +0200 |
| commit | 37a5dcd6837fc2afc44a7bc3ed8af4e983783d46 (patch) | |
| tree | 94b750d864bfe69d9ef7ae5c6d2ed609b62039b2 /tools/perf/scripts/python/stackcollapse.py | |
| parent | 8e68c380290b1dd64a0a512ce66d0264130c46ed (diff) | |
net: gro: properly validate BIG TCP aggregation criteria
When GRO attempts to aggregate IPv6 packets beyond GRO_LEGACY_MAX_SIZE
(64KB), the aggregate should only be permitted for plain IPv6 TCP flows
that have sufficient MAC header room to insert the temporary HBH jumbo header.
In 6.1.y, skb_gro_receive() had two issues with this check:
1. It checked skb_headroom(p) instead of the actual space before the MAC
header (p->mac_header). Because skb_headroom(p) measures (data - head),
it includes mac_len. Crafted frames (e.g. injected via AF_PACKET) can
pass the check with p->mac_header < 8 bytes. When ipv6_gro_complete()
inserts the temporary HBH jumbo header, the memmove() starts before
skb->head, causing an out-of-bounds write and wrapping skb->mac_header.
2. It checked p->encapsulation instead of NAPI_GRO_CB(skb)->encap_mark,
which is 0 during receive, failing to reject encapsulated IPv6 flows
(such as IP6IP6).
Fix skb_gro_receive() to strictly check:
- p->protocol == htons(ETH_P_IPV6)
- p->mac_header >= sizeof(struct hop_jumbo_hdr)
- ipv6_hdr(p)->nexthdr == IPPROTO_TCP
- Not encapsulated (!NAPI_GRO_CB(skb)->encap_mark && !p->encapsulation)
Returning -E2BIG from skb_gro_receive() ensures that packets which cannot
become BIG TCP are cleanly flushed at <= 64KB and delivered intact without
dropping.
This issue does not exist in mainline (7.0+) because the subsystem was
rewritten in commit 81be30c1f5f2 ("net/ipv6: Drop HBH for BIG TCP on RX
side"), making this fix relevant only for older stable branches like
6.18.y.
Fixes: 0fe79f28bfaf ("net: allow gro_max_size to exceed 65536")
Reported-by: Sam Dlinn <sledge@meta.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
