From: Florian Westphal <fw@strlen.de>
To: Zihan Xi <zihanx@nebusec.ai>
Cc: netfilter-devel@vger.kernel.org, virtualization@lists.linux.dev,
intel-wired-lan@lists.osuosl.org, bpf@vger.kernel.org,
pablo@netfilter.org, phil@nwl.cc, davem@davemloft.net,
edumazet@kernel.org, pabeni@redhat.com, horms@kernel.org,
kaber@trash.net, jengelh@medozas.de, andrew+netdev@lunn.ch,
mst@redhat.com, jasowangio@gmail.com, eperezma@redhat.com,
xuanzhuo@linux.alibaba.com, aleksander.lobakin@intel.com,
ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
john.fastabend@gmail.com, sdf@fomichev.me,
magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
willemb@google.com, alice.kernel@fastmail.im,
eilaimemedsnaimel@gmail.com, imv4bel@gmail.com,
shiming.cheng@mediatek.com, sd@queasysnail.net, vega@nebusec.ai,
root@tr0jan.top
Subject: Re: [PATCH nf v8 0/3] netfilter: bound asynchronous packet duplication
Date: Thu, 15 Oct 2026 12:39:12 +0200 [thread overview]
Message-ID: <atCtUFcG9b4ykXY3@strlen.de> (raw)
In-Reply-To: <cover.1792048855.git.zihanx@nebusec.ai>
Zihan Xi <zihanx@nebusec.ai> wrote:
> Hi Linux kernel maintainers,
>
> We found and validated an issue in netfilter packet duplication. The bug
> is reachable by an unprivileged user in user and network namespaces.
> Bounded tests exercised the fixes. Non-duplication packet semantics are
> intended to remain unchanged. MIRRED flow offload for affected netdev dup
> rules is rejected because it cannot enforce the duplication-depth limit.
>
> We will provide detailed information about the bug
> in this email, along with a PoC to trigger it.
Series makes no sense to me, sorry. I dislike the 2nd patch, I see no
reason why we need to make changes all over the place for this...?
Also, if we go with 2nd patch, why do we still need the first?
> The IPv4 and IPv6 duplication helpers use a task-local guard while a cloned
> packet traverses output hooks. If NFQUEUE suspends that traversal, the
> output call can return and clear the guard before a later verdict resumes
> the remaining hooks. The resumed packet can reach another duplication
> consumer without the original guard. This can cause repeated packet
> processing and consume CPU and network resources.
"Don't do that, then"?
I think the kernel should not crash when misused, but I don't think
kernel should have to do extreme stunts to detect such loops.
There are probably many other ways to make kernel allocate lots of
memory or waste cpu cycles.
E.g. via create use of veth and bridges, sched plug, teql, ...
> Patch 1 records the
> guard in the queue entry and restores it during reinjection. It keeps
> bottom halves disabled during the reinjection traversal, restoring the
> verdict task state before reenabling them.
Its small enough, so I have no objections to this patch.
> The netdev nft dup path has a separate synchronous transmit recursion
> counter. It does not accompany a duplicated skb through asynchronous
> software receive paths. Patch 2 carries a bounded duplication depth through
> skb and supported XDP conversions, resets it on reused buffers, and rejects
> MIRRED flow offload where the software depth cannot be enforced. This scope
> covers software skb/XDP continuity, not packet loops through physical
> hardware or userspace device round trips.
I think it would be better to first go to the drawing board and make ONE
facility that governs the recursion part.
From a quick glance, the difference is historical from time when
per-module pcpu counters were used, so nf_dup netdev could not see the state
of nft_dup toggle. Now that its in task struct anyway, maybe its time to
just zap the egress recursion counter and first make a patch that
uses the bool toggle for both egress and normal dup?
I would like to remove code, not add more.
> At PRE_ROUTING and LOCAL_IN, the IPv4 and IPv6 helpers decrement TTL or
> hop limit on the copy. Patch 3 stops creating copies when the value is
> <= 1, so the decrement cannot reach zero or wrap a zero value to the
> maximum.
Thats unrelated problem. There are other places that do TTL/HL
decrements. I think it makes sense to clean this up in -next and
add common helpers and then use those.
next prev parent reply other threads:[~2026-10-15 10:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 7:43 [PATCH nf v8 0/3] netfilter: bound asynchronous packet duplication Zihan Xi
2026-10-15 7:43 ` [PATCH nf v8 1/3] netfilter: nf_dup: preserve guard across NFQUEUE reinjection Zihan Xi
2026-10-15 7:56 ` sashiko-bot
2026-10-15 8:13 ` zihan xi
2026-10-15 7:43 ` [PATCH nf v8 2/3] netfilter: nf_dup_netdev: bound asynchronous duplication Zihan Xi
2026-10-15 7:43 ` [PATCH nf v8 3/3] netfilter: nf_dup: prevent TTL and hop-limit underflow Zihan Xi
2026-10-15 7:49 ` [PATCH nf v8 0/3] netfilter: bound asynchronous packet duplication netdev-bot+sinfo
2026-10-15 10:39 ` Florian Westphal [this message]
2026-10-15 11:33 ` 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=atCtUFcG9b4ykXY3@strlen.de \
--to=fw@strlen.de \
--cc=aleksander.lobakin@intel.com \
--cc=alice.kernel@fastmail.im \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=eilaimemedsnaimel@gmail.com \
--cc=eperezma@redhat.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=imv4bel@gmail.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jasowangio@gmail.com \
--cc=jengelh@medozas.de \
--cc=john.fastabend@gmail.com \
--cc=kaber@trash.net \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=mst@redhat.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=root@tr0jan.top \
--cc=sd@queasysnail.net \
--cc=sdf@fomichev.me \
--cc=shiming.cheng@mediatek.com \
--cc=vega@nebusec.ai \
--cc=virtualization@lists.linux.dev \
--cc=willemb@google.com \
--cc=xuanzhuo@linux.alibaba.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox