From: netdev-bot+sashiko@kernel.org
To: alishmery18@gmail.com
Cc: netdev@vger.kernel.org, idosch@nvidia.com, kuba@kernel.org,
pabeni@redhat.com, davem@davemloft.net, edumazet@kernel.org,
andrew+netdev@lunn.ch, horms@kernel.org, razor@blackwall.org,
roopa@nvidia.com, kuniyu@google.com, petrm@nvidia.com,
aroulin@nvidia.com, shuah@kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v5 3/8] vxlan: vnifilter: bound the number of VNIs one request may touch
Date: Mon, 16 Nov 2026 05:32:49 +0000 [thread overview]
Message-ID: <179480716972.3136.12449306559082331677@kernel.org> (raw)
In-Reply-To: <20261114221412.255825-4-alishmery18@gmail.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
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] RTM_NEWTUNNEL/RTM_DELTUNNEL requests that work today now fail
with -EINVAL whenever the spans of their entries add up to more than…
- [Low] The patch caps the number of VNIs one request walks.
- [Low] The commit message calls the change net-next hardening and "not a
backport candidate".
- [Low] The comment on vxlan_vni_filter_entry_range() says sharing the
helper means the count in vxlan_vnifilter_check_msg() "cannot drift…
--
vxlan: vnifilter: bound the number of VNIs one request may touch
This commit adds vxlan_vnifilter_check_msg(). It sums the VNI spans of
every VXLAN_VNIFILTER_ENTRY in an RTM_NEWTUNNEL or RTM_DELTUNNEL message.
If the total is over VXLAN_VNI_FILTER_MSG_MAX (4096), the whole message
is rejected with -EINVAL before any entry is applied. Range extraction is
now shared with vxlan_process_vni_filter() through the new
vxlan_vni_filter_entry_range() helper.
> This is hardening for net-next -- a policy narrowing of what a single
> message may ask for -- and is not a backport candidate.
[Severity: Low]
Could the commit message say who can trigger the unbounded walk? Stable
reviewers need that to decide on a backport.
RTM_NEWTUNNEL is registered without DOIT_UNLOCKED. The only permission
check is in rtnetlink_rcv_msg():
if (kind != RTNL_KIND_GET && !netlink_net_capable(skb, CAP_NET_ADMIN))
return -EPERM;
So root in a user namespace can create a vnifilter vxlan device in its
own netns. It can then send one entry spanning 0 to 0xffffff, which
vni_filter_vni_range accepts.
The message says one request can cover the whole 24-bit space. The only
timing it gives is for 1M VNIs (1.6 s). Scaled linearly, the full 16M
range would hold the global rtnl_lock for about 25 s. It would also
allocate a node and a per-CPU stats block per VNI, and before this series
that memory was not memcg-accounted.
Whether this belongs in stable is for the maintainers to decide. Could
the message state the user-namespace reachability and the hold time for
the full range?
> diff --git a/drivers/net/vxlan/vxlan_vnifilter.c b/drivers/net/vxlan/vxlan_vnifilter.c
> index 66a27198c65d2..127ed5b2a2eb7 100644
> --- a/drivers/net/vxlan/vxlan_vnifilter.c
> +++ b/drivers/net/vxlan/vxlan_vnifilter.c
[ ... ]
> +/* Reject a request touching more than VXLAN_VNI_FILTER_MSG_MAX VNIs before any
> + * of its entries is acted on. Both add and delete walk the span one VNI at a
> + * time under rtnl_lock, so both are bounded. Entries are applied one at a time
> + * and each one notifies as it goes, so a limit checked inside the dispatch loop
> + * would leave the entries ahead of the offending one already applied.
> + */
[Severity: Low]
Does capping the number of VNIs fully bound the rtnl hold time? For each
new VNI the walk goes through
vxlan_vni_add_del()->vxlan_vni_add()->vxlan_vni_in_use(). That last
function loops over every vxlan device in the netns:
drivers/net/vxlan/vxlan_core.c:vxlan_vni_in_use() {
...
list_for_each_entry(tmp, &vn->vxlan_list, next) {
...
if (tmp_cfg->flags & VXLAN_F_VNIFILTER) {
if (!vxlan_vnifilter_lookup(tmp, vni))
continue;
...
}
A request within the cap therefore still costs about 4096 * D steps
under rtnl_lock, where D is the number of vxlan devices in the netns. The
caller controls D.
This per-step cost was there before, and the patch does bound the walk
length as it says. The commit message says "That walk is the cost being
bounded". Could it also mention this second factor?
> +static int vxlan_vnifilter_check_msg(const struct nlmsghdr *nlh,
> + struct netlink_ext_ack *extack)
> +{
[ ... ]
> + vxlan_vni_filter_entry_range(vattrs, &vni_start, &vni_end);
> +
> + /* A start above the end selects no VNI and costs nothing;
> + * leave it behaving as it does today.
> + */
> + if (vni_end < vni_start)
> + continue;
[Severity: Low]
Does the comment on vxlan_vni_filter_entry_range() still hold for an
entry with neither VXLAN_VNIFILTER_ENTRY_START nor
VXLAN_VNIFILTER_ENTRY_END? It says the count "cannot drift from the range
vxlan_process_vni_filter() then acts on". The same question applies to
START set to 0 with END absent or 0.
The helper returns vni_start == vni_end == 0 for these entries. The check
above only skips inverted ranges, so such an entry is counted as one VNI.
vxlan_process_vni_filter() never walks such an entry; it rejects it:
if (!vni_start && !vni_end) {
NL_SET_ERR_MSG_ATTR(extack, nlvnifilter,
"vni start nor end found in vni entry");
return -EINVAL;
}
Take a message whose valid entries add up to exactly 4096 VNIs plus one
empty entry. The extack points at the empty entry and says "Request asks
for more than 4096 VNIs" instead of reporting the missing start/end.
Both paths return -EINVAL, so only the diagnostic and the comment are
affected. Could vxlan_vnifilter_check_msg() report this entry the same
way vxlan_process_vni_filter() does?
> +
> + /* vni_filter_entry_policy has already bounded both endpoints
> + * below VXLAN_N_VID, so one entry adds at most VXLAN_N_VID and
> + * vnis cannot wrap before the test below rejects it.
> + */
> + vnis += vni_end - vni_start + 1;
> + if (vnis > VXLAN_VNI_FILTER_MSG_MAX) {
> + NL_SET_ERR_MSG_ATTR_FMT(extack, attr,
> + "Request asks for more than %u VNIs",
> + VXLAN_VNI_FILTER_MSG_MAX);
> + return -EINVAL;
> + }
[Severity: Medium]
This rejects requests that work today. bridge(8) puts each range, or
each comma-separated item, into one VXLAN_VNIFILTER_ENTRY of a single
message. Each of these now fails with -EINVAL:
bridge vni add dev vxlan0 vni 10000-20000
a single range covering the whole 24-bit space
re-adding more than 4096 existing VNIs to change their group
There is no opt-out. Before this patch the only limit was the policy
maximum of VXLAN_N_VID - 1.
The series' own selftest ("selftests: net: test the vxlan vnifilter
request limit and dump replay") expects "bridge vni add dev vxlan-ext1
vni 20000-24096" to fail. Its comment notes that bridge(8) sends one
entry per comma-separated item in a single message. That selftest does
cover the 4096 accept and 4097 reject cases for add and delete.
The commit message says the space "can still be installed in more than
one request". Even so, scripts and configs that use one large range will
break on a kernel upgrade.
The 4096 figure also comes from the VLAN ID space, which does not apply
to collect_md vnifilter devices used without VLAN-derived VNIs.
Should the commit message say that existing bridge(8) usage with ranges
over 4096 VNIs will stop working?
> + }
> +
> + return 0;
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261114221412.255825-1-alishmery18%40gmail.com
next prev parent reply other threads:[~2026-11-16 5:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 22:14 [PATCH net-next v5 0/8] vxlan: vnifilter: bound a single request and account per-VNI memory Ali Firas
2026-11-14 22:14 ` [PATCH net-next v5 1/8] vxlan: vnifilter: reject VNIs outside the 24-bit space Ali Firas
2026-11-14 22:14 ` [PATCH net-next v5 2/8] vxlan: vnifilter: clamp the dumped VNI range to the request limit Ali Firas
2026-11-14 22:14 ` [PATCH net-next v5 3/8] vxlan: vnifilter: bound the number of VNIs one request may touch Ali Firas
2026-11-16 5:32 ` netdev-bot+sashiko [this message]
2026-11-14 22:14 ` [PATCH net-next v5 4/8] vxlan: vnifilter: account per-VNI memory to memcg Ali Firas
2026-11-14 22:14 ` [PATCH net-next v5 5/8] vxlan: leave FDB state and flags unchanged when an update fails Ali Firas
2026-11-16 5:32 ` netdev-bot+sashiko
2026-11-14 22:14 ` [PATCH net-next v5 6/8] vxlan: vnifilter: roll back a VNI add that fails Ali Firas
2026-11-14 22:14 ` [PATCH net-next v5 7/8] vxlan: vnifilter: account the default FDB entry to memcg Ali Firas
2026-11-14 22:14 ` [PATCH net-next v5 8/8] selftests: net: test the vxlan vnifilter request limit and dump replay Ali Firas
2026-11-16 5:32 ` 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=179480716972.3136.12449306559082331677@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alishmery18@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=aroulin@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=razor@blackwall.org \
--cc=roopa@nvidia.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