Article View: linux.kernel.netdev
Article #23212Re: [PATCH net-next v2 03/12] amt: key relay tunnels on a union amt_addr endpoint
From: netdev-bot+sashiko
Date: Thu, 26 Nov 2026 19:16
Date: Thu, 26 Nov 2026 19:16
124 lines
12544 bytes
12544 bytes
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
Technical Details
Message-ID:
<179572061610.3135.16297939691113808529@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372291-linux-kernel-netdev=dewy.ruReferences:
<20261125191450.2497936-4-omar@blockcast.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372291-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179572061610.3135.16297939691113808529@kernel.org> References: <20261125191450.2497936-4-omar@blockcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="542255"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:bL+Lu6EeEOeJeOnU4TDRhceYCuo= sha256:W33ARGbWCuWT1ediyNrd/S0WkIQeySAI8d6vVts3te4= sha1:JACvnar2DUEQcwQfcxrZ0Ht5mQs= sha256:8wkhUGnLGmr9tP7a+7BnoUcrrXP1sTOGXHbw6zt+B1c= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 82B8E125EF9; Thu, 26 Nov 2026 22:17:17 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sdiX205EqM1O; Thu, 26 Nov 2026 22:17:13 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-372291-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 6C129125EF5; Thu, 26 Nov 2026 22:17:04 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 5D87129DBE; Thu, 26 Nov 2026 19:17:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795720618; b=Fl1JekrB6zdjNHP11mrrvjoDCB1DsIg7f9yHwjdbTkv/X44rT7nZfWBn92YYaZEcKJXu 0A2+HTlEvTg8wq5DcxRj5v9Z8kxV2tADLuTYtH9vJhZq0leRmO2yiWgxcFZfeC7rn25Y+ hVLXTjTLr8kwkbFEwhaPZ+9dfsR3Qpu+fpxfC62fhPjeEahcv0I13HqQYnigr7xTJExKs riwLD9ZegOrogu7XmYnE2MZMS41yZpvJEhUdNoX0Jbjp0l2HjabNbEhR07O7BvVXPRgDV pkt7miH2YNTfGXo/67rrhuASzGPulXgcRW5X8VIGoqzNGULLgqeN7en2rksajresyvg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795720618; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=NZtY45FGkTmV1jsVONpLrGSZDkTyzaPfcIcXdwBvd8s=; b=cyRRjVTBfOh8ec6SFTMSE/KNI/PG8VMMnZ2cpTo9Cht/KNEzOrYDNu23f7CKi6w3haCE nY3lq4Ib9PrwUxlK0v7iKSm8w2MVfOZXVIAuIhZwNbzB6ogoKkfyjOpGqEReYlVscma2j PqVhQEg9lBZPvMc4ldc6Cq2TWvVBrl0pNGcRpXwBwwl+9y2+nvTYeEvdTE8Ia7azDvDf8 nYr4jymttqrtLwRLomn6T46bnzhsR/E3+kNwgFotMY6ROjt86RwECdxcj8SYTrkQ4ii5B 3Qn+CBq5/8cjOTxwFSmmIzB3LWjTH3DM86NYTFptPCK87cpjHPko+LJfUUd3aItb4Hg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GS5FAyek; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69C2F606A698; Thu, 26 Nov 2026 19:16:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GS5FAyek X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795720617; b=hNj5O0cbBF9SlM3sqSYrLSSbvXTnHbmnyUOj9zWLkmNc5rrnpSh9ADLJK/tn+ujN75DO bB1+UZDhg9s3NbLJh4XK4dniXvLkjrDRd5ngYJIVShqwO8cPuoOdmCx7RSUl4fARcyn+F NanIfqAM0VVDUW/KfNjHCo/f7B7MUjMEPR0FI7CNL7founNZT5mih4xyqAO62O7WOOuzZ +0snu3MZLEpaO6ES7+BZ4YEYxeZJJuIP0V3vExu8WoX0pRS5uzVFsMcDOCnFNHMp29AjX 1H9wP7oRQcoZggqMH7bboKyHe0loYvnqwZgFrQYSS07V690WlpK26gx90BRfye3ZAMQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795720617; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=NZtY45FGkTmV1jsVONpLrGSZDkTyzaPfcIcXdwBvd8s=; b=bmKtDjOWFoVNdnlNhmlun31C4zvHjg6c4Q/+qThYhNj+RIA0rs60Ph3GPPGR+N2tjMOv 3+BbxRJP9Cu06GDgUg4iXKHOhkHVLKA+64SCfqNbx8M7782HJn4KZW1pIbn72U1oWUXOw HxunEQWqTjVZ9/zHw80Gli1TQHJHRHo5A4UIY31Z2NEPmniZ+qK9DCsa/HhipVgRScCQb dmtg90HUiBI+Ir0wmAKmVoLhlIlwVIS/8kdpPNUfw2AArXouhueyh7f16Tjyy1amA41vy RnsVsLcOCScRA2rbyL+pQ9sKleFzA8uB8AD+BnsZoPZs0HhfYsr+ubJzidwkuKy7EaA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GS5FAyek; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B9F1606A684; Thu, 26 Nov 2026 19:16:57 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CA4E1F000D0; Thu, 26 Nov 2026 19:16:56 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795720617; bh=NZtY45FGkTmV1jsVONpLrGSZDkTyzaPfcIcXdwBvd8s=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=GS5FAyek4rmsv/62JCIZEzjSMYL2joihLtthb/bFtY62xEkM0QkdKgUcfNaDYjqAK 2hfY2W17dPdVAj123g2fjv2gLBZtwkakLvtpSovjYwtfX04GuM0tQVR+Vs9bCdoGNf mTWoqz48jpVl7YL1Z02r+8lmPXGB4hlQykYw6y/x8YseCdzxFsI+Sej6vAQEz6yF14 6a5F8vpc2ndE6ELGofmCk4/xfBN8urN40iZfUGSlyLw3ViE0vsuE591YBzi3uAwkSj aDQ19FFwT/jisDSPErge6K7zACBLEtNhLnHFhoHOSXE1KfUquFmsyHRu0CuOF7leR9 Qd8YYZfXYJ1Bg== X-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 X-In-Reply-To: <20261125191450.2497936-4-omar@blockcast.net> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list