From: Ido Schimmel <idosch@nvidia.com>
To: Zihan Xi <zihanx@nebusec.ai>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Benjamin Thery <benjamin.thery@bull.net>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Vega <vega@nebusec.ai>
Subject: Re: [PATCH net v3 1/1] ipmr: account multicast table and route memory
Date: Mon, 7 Sep 2026 15:18:30 +0300 [thread overview]
Message-ID: <20260907121830.GA647811@shredder> (raw)
In-Reply-To: <ef4076c94466ea4b147653e2b7f933778f245437.1788765185.git.zihanx@nebusec.ai>
On Mon, Sep 07, 2026 at 08:10:56AM +0000, Zihan Xi wrote:
> A netadmin in a user+net namespace can create many IPv6 multicast
> routing tables with MRT6_TABLE. Each unseen id allocates an mr_table,
> links it into mr6_tables, and leaves it until netns teardown. Those
> objects were not charged to memcg, so the host unreclaimable slab
> grows with the table count.
This reads like an IPv6-only fix, but it also applies to IPv4.
mr_table_alloc() is used by both families. Please reword this paragraph
to reflect that.
>
> Account mr_table allocations with GFP_KERNEL_ACCOUNT and mark the
> IPv4/IPv6 MFC caches SLAB_ACCOUNT. This matches the established
> handling of IP addresses, routes and alternate interface names.
The bots might complain that this doesn't cover unresolved cache entries
that are allocated from softIRQ context. This is correct, but: 1. They
expire after 10 seconds. 2. Bound by the socket's receive queue. See
commit 0079ad8e8dc3 ("ipmr: remove hard code cache_resolve_queue_len
limit"). Worth mentioning in the commit message.
>
> The first unaccounted IPv6 heap table appeared in commit 4e16880cb422
> ("netns: ip6mr: dynamically allocates vif6_table"), which replaced a
> static vif6_table[] with kcalloc(..., GFP_KERNEL). Commit
> 6bd521433942 ("ipv6: ip6mr: move mroute data into seperate structure")
> only wrapped that already-heap state into mr6_table. Commit
> d1db275dd3f6 ("ipv6: ip6mr: support multiple tables") only expanded
> the table count from 1 to N. IPv6 MFC entries were already unaccounted
> from commit 7bc570c8b4f7 ("[IPV6] MROUTE: Support multicast
> forwarding."); IPv4 ip_mrt_cache is older still.
>
> Fixes: 4e16880cb422 ("netns: ip6mr: dynamically allocates vif6_table")
I think it makes more sense to blame the commits that allowed user space
to create these tables:
Fixes: f0ad0860d01e ("ipv4: ipmr: support multiple tables")
Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables")
Your reproducer depends on it. And dropping / rewording the last
paragraph.
Please wait 24h before posting another version:
https://docs.kernel.org/next/process/maintainer-netdev.html
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Assisted-by: LLM
> Signed-off-by: Zihan Xi <zihanx@nebusec.ai>
next prev parent reply other threads:[~2026-09-07 12:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 8:10 [PATCH net v3 0/1] ipmr: unaccounted multicast table memory Zihan Xi
2026-09-07 8:10 ` [PATCH net v3 1/1] ipmr: account multicast table and route memory Zihan Xi
2026-09-07 12:18 ` Ido Schimmel [this message]
2026-09-07 12:53 ` zihan xi
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=20260907121830.GA647811@shredder \
--to=idosch@nvidia.com \
--cc=benjamin.thery@bull.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=vega@nebusec.ai \
--cc=zihanx@nebusec.ai \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.