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
Subject: Re: [PATCH net-next v2 03/12] amt: key relay tunnels on a union amt_addr endpoint
Date: Thu, 26 Nov 2026 19:16:56 +0000 [thread overview]
Message-ID: <179572061610.3135.16297939691113808529@kernel.org> (raw)
In-Reply-To: <20261125191450.2497936-4-omar@blockcast.net>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
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] This patch makes the per-source tunnel cap compare the full
16-byte union amt_addr endpoint with memcmp() (amt_addr_equal()).
- [Low] The commit message says 'amt_request_handler() and
amt_update_handler() take that snapshot on entry, before…
--
amt: key relay tunnels on a union amt_addr endpoint
This commit stores the relay tunnel endpoint as a union amt_addr instead
of a __be32 and matches endpoints with amt_addr_equal(). It adds
amt_outer_saddr() to snapshot the outer source address and amt_relay_mac()
to compute the Membership Update MAC over the full endpoint.
> amt_outer_saddr() copies the outer source address of a received message
> by value into a zeroed union amt_addr. amt_request_handler() and
> amt_update_handler() take that snapshot on entry, before
> pskb_may_pull() and iptunnel_pull_header() can reallocate the header,
[Severity: Low]
Is this description accurate for amt_request_handler()?
It holds for amt_update_handler(), where amt_outer_saddr() runs before
both pskb_may_pull() and iptunnel_pull_header().
In amt_request_handler(), though, the snapshot is taken after the
function's only pskb_may_pull(), and that handler never calls
iptunnel_pull_header():
if (!pskb_may_pull(skb, sizeof(*udph) + sizeof(*amtrh)))
return true;
amt_outer_saddr(amt, skb, &saddr);
The code itself looks fine. ip_hdr() and ipv6_hdr() are derived again after
the pull, and nothing pulls after the snapshot.
Could the commit message be changed to describe the ordering in
amt_request_handler() correctly?
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 52ccaca08b5ec..38740e0ace424 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
[ ... ]
> @@ -3198,7 +3231,8 @@ static bool amt_request_handler(struct amt_dev *amt, struct sk_buff *skb)
> */
> rcu_read_lock();
> list_for_each_entry_rcu(tunnel, &amt->tunnel_list, list) {
> - if (tunnel->ip4 != iph->saddr || READ_ONCE(tunnel->dead))
> + if (!amt_addr_equal(&tunnel->addr, &saddr) ||
> + READ_ONCE(tunnel->dead))
> continue;
> per_src++;
> if (tunnel->source_port == udph->source)
[ ... ]
> @@ -3210,15 +3244,12 @@ static bool amt_request_handler(struct amt_dev *amt, struct sk_buff *skb)
> if (!have && (full || per_src >= amt_max_tunnels_per_src(amt)))
> return true;
>
[Severity: Medium]
Does an exact 16-byte compare still make the per-source cap work on an
IPv6 relay?
amt_tunnel_get_or_create() uses the same exact match before it allocates
a tunnel:
list_for_each_entry(tunnel, &amt->tunnel_list, list) {
if (!amt_addr_equal(&tunnel->addr, saddr) ||
READ_ONCE(tunnel->dead))
continue;
...
if (amt->nr_tunnels >= amt->max_tunnels ||
per_src >= amt_max_tunnels_per_src(amt)) {
amt_max_tunnels_per_src() caps the count at
clamp(max_tunnels / 8, 1, AMT_MAX_TUNNELS_PER_SRC). Its comment says it
limits "the tunnels one verified source address may hold".
On IPv6 this counts per /128. The MAC return-routability check only shows
that the sender can receive at one /128. An ordinary host usually has at
least a /64 routed to it (SLAAC or prefix delegation).
The defaults are a max_tunnels of 128 and 16 tunnels per source. Could one
host run Request -> Query -> Update from eight addresses in its /64, fill
the table, and keep it full by refreshing last_seen? After that, full
would be true here and every legitimate gateway would be refused a Query.
Over IPv4 the same attack needs eight separate IPv4 addresses.
This can't be reached at this commit, since amt_v6() is false. It becomes
reachable later in the series, when "amt: add netlink attributes for an
IPv6 outer transport" adds IFLA_AMT_LOCAL_IP6.
The selftest in "selftests: net: add amt_v6.sh for an IPv6 outer
transport" only checks that two gateways in the same /64 are kept apart.
The commit message only says that the per-source count "compares the
same way".
Would counting per /64 for IPv6 (or per a configurable prefix) keep the
cap doing its job? The cap allows up to 16 tunnels per source, so
separate gateways in one /64 would still be kept apart.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125191450.2497936-1-omar%40blockcast.net
next prev parent reply other threads:[~2026-11-26 19:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 19:14 [PATCH net-next v2 00/12] amt: add an IPv6 outer transport Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 01/12] amt: create an AF_INET6 encapsulation socket for an IPv6 outer address Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 02/12] amt: send the Relay Advertisement over IPv6 Omar Ramadan
2026-11-26 19:16 ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 03/12] amt: key relay tunnels on a union amt_addr endpoint Omar Ramadan
2026-11-26 19:16 ` netdev-bot+sashiko [this message]
2026-11-25 19:14 ` [PATCH net-next v2 04/12] amt: send the Membership Query over IPv6 Omar Ramadan
2026-11-26 19:16 ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 05/12] amt: forward multicast data " Omar Ramadan
2026-11-26 19:16 ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 06/12] amt: size the encapsulation headroom by the outer IP version Omar Ramadan
2026-11-26 19:17 ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 07/12] amt: send the AMT gateway control plane over IPv6 Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 08/12] amt: receive " Omar Ramadan
2026-11-26 19:17 ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 09/12] amt: add netlink attributes for an IPv6 outer transport Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 10/12] MAINTAINERS: amt: cover the amt headers and selftests Omar Ramadan
2026-11-25 19:14 ` [PATCH net-next v2 11/12] selftests: net: add amt_v6.sh for an IPv6 outer transport Omar Ramadan
2026-11-26 19:17 ` netdev-bot+sashiko
2026-11-25 19:14 ` [PATCH net-next v2 12/12] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes Omar Ramadan
2026-11-26 19:17 ` 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=179572061610.3135.16297939691113808529@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 \
/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