Netdev List
 help / color / mirror / Atom feed
From: Aviral Srivastava <aviralyash27@gmail.com>
To: netdev@vger.kernel.org
Cc: netdev-bot+sashiko@kernel.org, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	willemb@google.com, horms@kernel.org
Subject: Re: [PATCH net] udp: gro: do not match tunnel-processed and plain packets
Date: Mon, 23 Nov 2026 17:38:04 -0800	[thread overview]
Message-ID: <20261124013804.96778-1-aviralyash27@gmail.com> (raw)
In-Reply-To: <179545921450.3135.6404804724515356262@kernel.org>

Thanks for the review. Both points lead to changes, I will send a v2.

[Medium] Fixes tag covers only the out-of-bounds read

Agreed. The port match through udp_hdr(p) dates from e20cf8d3f1f7 and
the merge does not depend on 4b0ebbca3e16. I checked it on v6.6.162,
which does not have 4b0ebbca3e16 (arm64 QEMU, KASAN, netns over veth):

- vxlan with inner TCP, UDP_GRO socket on the port, plain datagram
  with the same outer TTL, TOS and DF as the vxlan packet: 2000 of
  2000 datagrams end up inside the inner TCP segments on the vxlan
  device, none reach the UDP socket. No KASAN report.
- Same with consecutive IP IDs and no DF: 2000 of 2000.
- Same with the plain datagram's TTL off by one: 0 merged. Differing
  ports, no tunnel device, GRO off: 0 merged.
- With the v1 hunk applied to v6.6.162: 0 merged in every case, and
  UDP in vxlan/geneve still aggregates.

On v6.6 the L3 gate is the flush/flush_id state from 5babae777c61,
computed on the two real outer headers, so ordinary header values are
enough there. v2 carries both tags, e20cf8d3f1f7 first, and Cc: stable.
The hunk applies to 6.6.y, 6.1.y, 5.15.y and 5.10.y as is.

[Low] encap_mark is cleared by FOU/GUE

The observation is right and the comment and changelog in v1 are wrong
on this. I do not think an is_fou comparison is needed, though:

- When FOU/GUE carry IPIP, SIT or GRE (or vxlan), the inner handler
  sets encap_mark again and the transport header moves to the inner L4
  header. Those are covered by the v1 check: they give the same KASAN
  report against plain UDP before the patch and none after.
- When FOU/GUE carry UDP directly, encap_mark is 0, but nothing moves
  the transport header or the network offsets, so udp_hdr(p) is the
  outer UDP header, the same layer as for a plain packet. A plain
  datagram with those ports resolves to the FOU socket itself in the
  GRO lookup, so it does not reach udp_gro_receive_segment().

I ran held plain UDP followed by FOU/GUE-direct UDP with matching inner
ports, and the reverse order, with a wildcard, a single-tunnel and a
connected FOU socket, with a UDP_GRO socket, rx-udp-gro-forwarding and
rx-gro-list: no cross merge and no KASAN report, with or without the
patch. The only merge with differing is_fou I could produce needs the
FOU port to be deleted while a packet is held; it is at the same header
layer and in bounds.

v2 keeps the code and rewords the comment and changelog to say what
encap_mark guarantees at that point.

Separately, UDP carried directly in FOU/GUE never aggregates in
udp_gro_receive_segment(), because the inner header is compared with
the held packet's outer one. That is not a regression and not changed
by this patch.

The v1 notes also said "28 and 29" KASAN reports. That was the dmesg
ring limit, the console logs of those runs have 1023 and 308. And the
changelog said the merged datagram is not seen by the forward and
egress netfilter hooks; the hooks do see the aggregate, what is skipped
are rules matching the datagram itself. Both are corrected in v2.

pw-bot: cr

      reply	other threads:[~2026-11-24  1:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 18:39 [PATCH net] udp: gro: do not match tunnel-processed and plain packets Aviral Srivastava
2026-11-23 18:40 ` netdev-bot+sashiko
2026-11-24  1:38   ` Aviral Srivastava [this message]

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=20261124013804.96778-1-aviralyash27@gmail.com \
    --to=aviralyash27@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.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