Article View: linux.kernel.netdev
Article #23987Re: [PATCH net-next v4 2/3] amt: bound the source-state work of one Membership Update
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 21:28
Date: Sat, 28 Nov 2026 21:28
151 lines
13817 bytes
13817 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] This patch closes a CPU-exhaustion problem that a remote host can
trigger in the AMT relay, but it carries no Fixes: tag and is not…
- [Low] The new comment above AMT_REC_WALKS/AMT_REC_LOOKUPS in
include/net/amt.h (lines ~395-400) says the constants bound "the…
- [Low] amt_rec_cost() (drivers/net/amt.c:2164-2168) assumes every pass
may walk hash_buckets + nr_sources + nsrcs nodes, i.e. that…
--
amt: bound the source-state work of one Membership Update
The patch charges each IGMPv3/MLDv2 group record in a Membership Update
for the walks and lookups it causes. It stops applying records once the
total exceeds twice the cost of refreshing the tunnel's whole state.
Records for groups the tunnel has no room for are skipped and not charged.
> Found by review (Sashiko, on the limits patch); not triggered at runtime.
[Severity: Low]
Should this carry Fixes: tags and be routed through net as a bug fix?
Before this patch, amt_igmpv3_report_handler() and
amt_mldv2_report_handler() applied every record under tunnel->lock in
softirq. The only bound was ip_mc_may_pull()/ipv6_mc_may_pull().
Any host that completes the Request/Query exchange gets a valid response
MAC. It can then send a reassembled Update of up to about 64 KB with
roughly 8000 empty records naming one group. Each record makes several
full passes over the group's 256 buckets: the amt_lookup_act_srcs() passes
plus the two in amt_cleanup_srcs().
The loops date back to:
Fixes: bc54e49c140b ("amt: add multicast(IGMP) report message handler")
Fixes: b75f7095d4d4 ("amt: add mld report message handler")
Without these tags, stable kernels keep the length-only bound. The
"not triggered at runtime" line also doesn't say that the issue can be
reached remotely. The earlier patch "amt: make the A-B source walk linear"
has the same gap.
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 79d68bcc7ccfd..177bc0b7cb1fd 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
> @@ -2157,6 +2157,30 @@ static void amt_igmpv2_leave_handler(struct amt_dev *amt, struct sk_buff *skb,
> amt_del_group(amt, gnode);
> }
>
> +/* The source-state work one group record can cause: AMT_REC_WALKS passes
> + * over the group's buckets and sources, which add_srcs may grow by nsrcs,
> + * plus AMT_REC_LOOKUPS hash lookups per record source.
> + */
> +static u64 amt_rec_cost(const struct amt_dev *amt, u32 nr_sources, u16 nsrcs)
> +{
> + return (u64)AMT_REC_WALKS * (amt->hash_buckets + nr_sources + nsrcs) +
> + (u64)AMT_REC_LOOKUPS * nsrcs;
[Severity: Low]
Does the walk term over-charge sources the relay will refuse?
The term assumes amt_add_srcs() can grow the group by the full nsrcs.
However, amt_add_srcs() stops once the tunnel is full:
drivers/net/amt.c:amt_add_srcs() {
...
for (i = 0; i < nsrcs; i++) {
if (tunnel->nr_sources >= amt->max_sources)
return;
...
}
So a walk never visits more than hash_buckets + max_sources nodes.
Refused sources already pay their lookup cost through AMT_REC_LOOKUPS.
They are also charged AMT_REC_WALKS units each for walk growth that cannot
happen.
The charge and the break run before amt_add_group(), amt_add_srcs() and
the mode handlers. At the defaults, the budget is 120320 and a new-group
record costs 1792 + 15 * nsrcs. A first record with more than about 7900
IPv4 sources therefore trips work > budget at i == 0, and none of the
Update is applied.
Smaller spreads get cut early too. For example, 32 records of 160 sources
are charged about 134k, while the real worst-case work is about 99k.
Normal hosts split reports to the MTU, so this needs MTUs above roughly
16 KB, or a sender that only damages its own state.
The commit message says "records the relay refuses cannot use up the
budget". That rule is applied to groups but not to sources. Would capping
the nsrcs inside the walk term at the remaining room
(max_sources - tunnel->nr_sources) match the growth that can actually
happen?
> +}
[ ... ]
> diff --git a/include/net/amt.h b/include/net/amt.h
> index f36efcdd92d0b..82aaa6b3070fb 100644
> --- a/include/net/amt.h
> +++ b/include/net/amt.h
> @@ -392,6 +392,14 @@ struct amt_dev {
> #define AMT_GC_KICK 2048
> #define AMT_MAX_GROUP 32
> #define AMT_MAX_SOURCE 128
> +/* Per group record, an upper bound on the passes the mode handlers plus
> + * amt_cleanup_srcs() make over a group's buckets and sources, and on the
> + * hash lookups they make per record source. The handlers need at most 5
> + * and 7 (EXCLUDE TO_IN and EXCLUDE BLOCK); the bound is rounded up so a
> + * later pass does not silently exceed it. See amt_rec_cost().
> + */
[Severity: Low]
Does the count of 7 lookups per source match the functions this comment
names?
In amt_mcast_block_handler(), the EXCLUDE branch calls
amt_lookup_act_srcs() with AMT_OPS_SUB_REV, AMT_OPS_UNI, AMT_OPS_SUB_REV
and AMT_OPS_UNI. That is 6 lookups per source. amt_cleanup_srcs() makes no
per-source lookups.
The seventh comes from amt_add_srcs(), which runs before every mode
handler:
if (amt_lookup_src(tunnel, gnode, AMT_FILTER_ALL, &src))
continue;
amt_add_srcs() is not listed here. The amt_rec_cost() comment mentions it
only as growing the source count.
The constants are still valid upper bounds today. Someone re-deriving the
bound from the listed functions would find 6 lookups and assume 2 of
headroom under AMT_REC_LOOKUPS, when the real headroom is 1. Could the
comment list amt_add_srcs() as a contributor?
> +#define AMT_REC_WALKS 7
> +#define AMT_REC_LOOKUPS 8
> #define AMT_HSIZE_SHIFT 8
> #define AMT_HSIZE (1 << AMT_HSIZE_SHIFT)
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124210501.70394-1-omar%40blockcast.net
Technical Details
Message-ID:
<179590132102.3135.11903676498042609823@kernel.org>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373282-linux-kernel-netdev=dewy.ruReferences:
<20261124210501.70394-3-omar@blockcast.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373282-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v4 2/3] amt: bound the source-state work of one Membership Update Date: Sat, 28 Nov 2026 21:28:41 +0000 Organization: Usenet Network Message-ID: <179590132102.3135.11903676498042609823@kernel.org> References: <20261124210501.70394-3-omar@blockcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1032756"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ydcuzUsxXsk62oAqZFaUig/d3qw= sha256:nDDnFF2ofFf1NrMNnZ9dEtyWZ1+8MlcR+Ud/RK1HGMU= sha1:UhNpaVKHyACumDEkuo7tfR0EToU= sha256:78mP181MsbLrIxsTeFkEbQ6PwHagoA1Ed6rWzbF1PAk= 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 E255B125F8D; Sun, 29 Nov 2026 00:28:58 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[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, URIBL_BLOCKED=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 zTwD01MZLoXB; Sun, 29 Nov 2026 00:28:55 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-373282-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id CA4BD125F8A; Sun, 29 Nov 2026 00:28:45 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 461ED601B74; Sat, 28 Nov 2026 21:28:44 +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=1795901323; b=a2c/8TlpJx9vVoHP1ex2mn7k3fook81Ale/HkzbyOp6rkNsvjKEcxs67hMldxg/SDyIN Rph0mF9pb+Lsbwj7ty18XNkrhIpT+ywnUwQTRbeXdYHe3BElPUgwR1TCqlCMNE75+zpKx j3KNWl6HSVHIk1KxY5N7IeNdYEHnJh4/auOmi5NZUZlE05YpxNXfuH+tGERYRIHPI6bJ7 OiYQi3+mX5MXJgRc5jCUdYJWOv5QoK8VpSUXkhYFta9wO8TWuR673nQ0emiirVAD6ohgU Za7z8IsUm6gFQc8f8wOvCLENtFIMYIAqZjLUl2NNQr7E9Kk1a1f7X3QMgqBI32V0w6A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795901323; 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=ielV6tM/52wXULSXTeUVRzuABqzYUW8PnNdu+mfFnRE=; b=4v/M6muZxZtjUUVtxbvVK3TtJL9cAnus5BiTeAWPbrxwqzq5lmgrpyiWKfcRZT2D1qlx ShFYEMrlSTdhUEcq7Fp/Zk73kk8+g+eFvj2erP97NvDZqsgRjGmLjzGEo2tNDKzxzZ+3h yJdm8Y1hy0hP3frj/Rz7sQND4r3Lcn8Ni8kTiYFEv35E9Hg2gPne4em+2sG1LDIDszVyQ ONReXMi8wuxfl8g+pzRjbBEeZyXOWvRIUrmGsY2cObQUCvRUHG0yjyi7xRITvvW0PxG9g 7+mdWLdu77Qdfh6XFZ+fDrDEOr0els2MXjUSIwcM1Yz6KAPRcfevGwFdsmruMrxJEEw== 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=YTWSz1tB; 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 485C6606A32D; Sat, 28 Nov 2026 21:28:43 +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=YTWSz1tB 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=1795901322; b=JkVBUbeVheJHOF46WxVnAxTlWi5vSFCCZhf143u+/urJ/CmMgLYMezrfZ4PZQtJpkYwD 5NSzBOH65uixMHePF3191OouIyhkFGhkbjs/AL6G6Mxabn4ARWcbrW34E8zwtG7lM94lt dQaCZopgoSRpk1PtjFFMSFjXmMzcTXXpl5kgp511ZOmZ+X8i74tQ39HMvhOK6hidNZd6M v9wllGyFz70vlQsxT1ruL07lstbTPqD1C+r2ig6rbsi9roaai/w+Z6v0FNNF219gm6Z7P pFa+tmQsmbVOIOhhijJjvRwdPRH7lKbhq4hIqEjPolmyXQKh6P9EyBcFGKlG+X/MmGg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795901322; 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=ielV6tM/52wXULSXTeUVRzuABqzYUW8PnNdu+mfFnRE=; b=22jn2cnNo9GcH07HgLCF2k4n0zeuH/gywBYfup9o0UmQTEMvVv9+UVgTAubWfsmT3nHv mMl8d3zvtvfHq1fKNFeJTbearDSam2koby+1w7GB3ygW2FhT2Adk6MvNKw3yapcs9w2KG bVvxoVnEXNwv673E/m5tM2JHO2BS8S5zVgwUDRhi92oAeGMw9KzXE7Jlb/EMyWWMxA9jP pEGDNTdCvk1Nsaduz8xfn36J7eHrxAb+wc8OiGhqK+f9HpcOiw8mXLrnE84bZaarLvOrc nva+F074U4sIvf10zrfHNzZ9zrkJDa5vFIgmeMXZMIEBfXZOtnYufN1ENsC2g25odUg== 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=YTWSz1tB; 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 622E7606A323; Sat, 28 Nov 2026 21:28:42 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77CFC1F00899; Sat, 28 Nov 2026 21:28:41 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795901322; bh=ielV6tM/52wXULSXTeUVRzuABqzYUW8PnNdu+mfFnRE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=YTWSz1tBCM41SZnKyFSvxlNt4Y3sh1V/H7HjEgGqBAG7PbHeJVa+iXSnZHSsXmc3V 4HrEmxNsN+Y/K+LOifOo4XzvWvGLTNFkMAaciK4MnilEmi08JH3DwDudGe/HwQ3qvJ wr0YPiGyNGh15b1Utt6vV1I6LtPydQSJlB9gQEW1aKZmGqMYkxXzO73p3PxYvOE1Hl Gkgbd4tAzqMGla/kwiVMe++pNeIzt+2cPy6pMcwIWecAWsHjNMTel1j7BRIwcw8ttX 7s2KuERgRPs64ccy4wJ6phsq5wR5xyHnHcQZYTLPcy6m/pJb7HIZ0t3yyX+6FLOnY6 QzSci1ppIwLZw== X-Cc: ap420073@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org X-In-Reply-To: <20261124210501.70394-3-omar@blockcast.net> X-sashiko-severity: Low 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