From: netdev-bot+sashiko@kernel.org
To: omar@blockcast.net
Cc: ap420073@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
shuah@kernel.org, horms@kernel.org, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
willemb@google.com
Subject: Re: [PATCH net-next v3 05/12] amt: forward multicast data over IPv6
Date: Sat, 28 Nov 2026 09:48:39 +0000 [thread overview]
Message-ID: <179585931904.3135.10573142335250073634@kernel.org> (raw)
In-Reply-To: <20261127094703.3025517-6-omar@blockcast.net>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message understates what a forged ICMPv6 Packet Too
Big does to a gateway, and the same applies to any real path whose…
- [Low] The commit message says 'A copy that cannot be sent is still
freed, but it is now counted in tx_dropped and freed with a drop…
- [Low] Two header comments in drivers/net/amt.c do not match the code.
--
amt: forward multicast data over IPv6
This patch sends the relay's copy of a multicast packet through
amt_udp_xmit(), so it can go out with an IPv6 outer header as well as an
IPv4 one. Over IPv6 the route is looked up first. A payload larger than
the route MTU less the outer and AMT headers is dropped, and after
walking all tunnels amt_dev_xmit() sends one ICMPv6 Packet Too Big.
> The route MTU never drops
> below IPV6_MIN_MTU, as a smaller Packet Too Big is ignored, so a forged
> Packet Too Big can at most lower the tunnel MTU to 1280 bytes less the
> outer headers; an IPv6 payload between that and 1280 bytes is then
> undeliverable.
[Severity: Medium]
Is this an accurate description of the effect? With a route PMTU of 1280,
amt_tmtu() returns 1280 - (40 + 8 + 2) = 1230:
u32 hlen = sizeof(struct ipv6hdr) + sizeof(struct udphdr) +
sizeof(struct amt_header_mcast_data);
...
return mtu > hlen ? mtu - hlen : 0;
amt_send_multicast_data() then drops every inner packet, or GSO segment,
larger than 1230 bytes toward that gateway. This applies to IPv4 and IPv6
inner payloads alike.
1230 is below IPV6_MIN_MTU, so this check leaves *ptb at zero:
if (tmtu >= IPV6_MIN_MTU && (!*ptb || tmtu < *ptb))
*ptb = tmtu;
As a result, amt_dev_xmit() never calls icmpv6_ndo_send(). An IPv6 source
sending multicast larger than 1280 bytes gets no Packet Too Big and loses
every packet. Even with a signal it could not recover, since it never
sends below 1280. IPv4 payloads above 1230 bytes are dropped silently too.
The forged PTB reaches the route through udpv6_err() ->
udpv6_err_update_exception() -> ip6_update_pmtu() before the socket
lookup, and an mtu of 1280 is accepted. A real path whose PMTU is between
1280 and 1329 bytes has the same effect.
Doesn't this mean an off-path sender can silently black-hole all
multicast above 1230 bytes toward a chosen gateway, including common
1316-byte MPEG-TS payloads? That is wider than IPv6 payloads between 1230
and 1280 bytes. Could the commit message describe the real scope, or
could the design be reconsidered?
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 70be70ed5ce03..3972b3eccc913 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
[ ... ]
> @@ -1374,26 +1402,58 @@ static bool amt_send_membership_update(struct amt_dev *amt,
> return false;
> }
>
> +/* Send the relay's copy of a multicast packet to one gateway. Over IPv6 a
> + * payload that does not fit the tunnel MTU is dropped, and *@ptb is lowered
> + * to that MTU so that amt_dev_xmit() can send a single Packet Too Big to
> + * the source once it has walked every tunnel.
> + */
> static void amt_send_multicast_data(struct amt_dev *amt,
> const struct sk_buff *oskb,
> struct amt_tunnel_list *tunnel,
> - bool v6)
> + bool v6, u32 *ptb)
> {
[ ... ]
> - skb = skb_copy_expand(oskb, sizeof(*amtmd) + sizeof(*iph) +
> + if (amt_v6(amt)) {
> + u32 tmtu;
> +
[ ... ]
> + tmtu = amt_tmtu(dst);
> + if (amt_tmtu_exceeded(oskb, tmtu)) {
> + dst_release(dst);
> + /* A source ignores a Packet Too Big below
> + * IPV6_MIN_MTU, so a tunnel that small is only
> + * dropped for.
> + */
> + if (tmtu >= IPV6_MIN_MTU && (!*ptb || tmtu < *ptb))
> + *ptb = tmtu;
> + DEV_STATS_INC(amt->dev, tx_dropped);
> + return;
> + }
> + }
[Severity: Low]
Do the header comments match this check? The comment on
amt_send_multicast_data() says *@ptb is lowered to the failing tunnel
MTU. The comment above amt_tmtu() says:
... a payload larger than the tunnel MTU is
dropped, and an IPv6 source is sent a Packet Too Big.
Some failing tunnels never update *ptb, so no Packet Too Big is sent for
them. These are tunnels with tmtu below IPV6_MIN_MTU, including tmtu == 0
when dst_mtu() is 50 or less.
*ptb is also lowered for inner IPv4 payloads. Only the "ptb && v6" check
in amt_dev_xmit() keeps those from producing a Packet Too Big.
The inline comment here covers the IPV6_MIN_MTU case. Could the two
header comments mention these conditions too?
> +
> + skb = skb_copy_expand(oskb, sizeof(*amtmd) + amt_ip_hlen(amt) +
> sizeof(struct udphdr), 0, GFP_ATOMIC);
> - if (!skb)
> + if (!skb) {
> + dst_release(dst);
> return;
> + }
>
> /* amt_dev_xmit() pulled the Ethernet header without moving the mac
> * header. The tunnelled payload has no link-layer header, so the
> @@ -1402,18 +1462,7 @@ static void amt_send_multicast_data(struct amt_dev *amt,
> skb_reset_mac_header(skb);
> skb_reset_inner_headers(skb);
> if (udp_tunnel_handle_offloads(skb, true)) {
> - kfree_skb(skb);
> - return;
> - }
> -
[ ... ]
> + dst_release(dst);
> kfree_skb(skb);
> return;
> }
[Severity: Low]
The commit message says:
A copy that cannot be sent is still freed, but it is now counted in
tx_dropped and freed with a drop reason
Should these two failure paths count the drop as well?
If skb_copy_expand() returns NULL, for example on a GFP_ATOMIC failure
under memory pressure, the function returns without touching tx_dropped.
If udp_tunnel_handle_offloads() fails, the copy is freed with a plain
kfree_skb(), with no drop reason and no tx_dropped increment. That branch
is close to unreachable for a freshly copied skb, though.
Only three paths are counted: the IPv6 route lookup failure, the tunnel
MTU check, and the amt_udp_xmit() error branch with
kfree_skb_reason(skb, SKB_DROP_REASON_IP_OUTNOROUTES). Since
amt_dev_xmit() always returns NETDEV_TX_OK, copies lost on the other two
paths show up in no counter.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127094703.3025517-1-omar%40blockcast.net
next prev parent reply other threads:[~2026-11-28 9:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 9:46 [PATCH net-next v3 00/12] amt: add an IPv6 outer transport Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 01/12] amt: create an AF_INET6 encapsulation socket for an IPv6 outer address Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 02/12] amt: send the Relay Advertisement over IPv6 Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 03/12] amt: key relay tunnels on a union amt_addr endpoint Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
2026-11-27 9:46 ` [PATCH net-next v3 04/12] amt: send the Membership Query over IPv6 Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
2026-11-27 9:46 ` [PATCH net-next v3 05/12] amt: forward multicast data " Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko [this message]
2026-11-27 9:46 ` [PATCH net-next v3 06/12] amt: size the encapsulation headroom by the outer IP version Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 07/12] amt: send the AMT gateway control plane over IPv6 Omar Ramadan
2026-11-27 9:46 ` [PATCH net-next v3 08/12] amt: receive " Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
2026-11-27 9:47 ` [PATCH net-next v3 09/12] amt: add netlink attributes for an IPv6 outer transport Omar Ramadan
2026-11-27 9:47 ` [PATCH net-next v3 10/12] MAINTAINERS: amt: cover the amt headers and selftests Omar Ramadan
2026-11-27 9:47 ` [PATCH net-next v3 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
2026-11-27 9:47 ` [PATCH net-next v3 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes Omar Ramadan
2026-11-28 9:48 ` netdev-bot+sashiko
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=179585931904.3135.10573142335250073634@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=omar@blockcast.net \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--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