From: Florian Westphal <fw@strlen.de>
To: zihan xi <zihanx@nebusec.ai>
Cc: linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, kprateek.nayak@amd.com, pablo@netfilter.org,
phil@nwl.cc, davem@davemloft.net, edumazet@kernel.org,
pabeni@redhat.com, horms@kernel.org, kaber@trash.net,
jengelh@medozas.de, lukas@wunner.de, vega@nebusec.ai,
root@tr0jan.top
Subject: Re: [PATCH nf v7 1/1] netfilter: nf_dup: preserve duplication guard across NFQUEUE
Date: Wed, 14 Oct 2026 12:40:42 +0200 [thread overview]
Message-ID: <as9cKonuO_37jfA5@strlen.de> (raw)
In-Reply-To: <CAANe3eQSU06GJAaaj8Fd=S+THSJn0Eu+1Bt_E=VNZ0=rAQXnBQ@mail.gmail.com>
zihan xi <zihanx@nebusec.ai> wrote:
> Hi Florian,
>
> Thanks again for the review. I tested the simpler approach you suggested:
> extending the local_bh_disable() / local_bh_enable() scope in
> nf_reinject() to cover hook lookup, hook traversal, and okfn execution.
> The experiment changed only nfnetlink_queue.c and built successfully
> against nf.git main at ab699d296e06.
>
> I ran the IPv6 TEE/NFQUEUE reproducer in a 2-vCPU, 2-GiB QEMU guest
> in a network namespace owned by a non-initial user namespace, with:
>
> QUEUE_COUNT=1
> PAYLOAD=1
> TEE_CLONES=1
> panic_on_oom=0
>
> The bounded run reached 68,881 callback iterations in 6.700 seconds and
> exited normally. No OOM, panic, Oops, BUG, or soft lockup was observed.
> This was a bounded resource-consumption run, not an OOM or crash test.
>
> The reproducer continued executing the callback loop throughout the
> bounded run, so extending the BH-disabled region alone does not address
> this case. It protects against BH interference during nf_reinject(), but
> it does not preserve current->in_nf_duplicate across the asynchronous
> NFQUEUE verdict path: the original ip_local_out() or ip6_local_out()
> call has already returned and cleared the task-local guard before
> reinjection starts.
Why? You'd store the current->in_nf_duplicate struct nf_queue_entry
at queue time ("this skb is due to recursion via nf dup").
Then, on reinject, you'd set current->in_nf_duplicate to the
value stashed in struct nf_queue_entry so that if we were queued earlier
from the recursion a potential further 'dup' would see current->in_nf_duplicate
as true and skip next duplication round.
I think one could add a 'DEBUG_NET_WARN_ONCE(current->in_nf_duplicate)'
in nf_reinject, I don't see how it could be set on function entry.
What did I miss?
next prev parent reply other threads:[~2026-10-14 10:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 11:28 [PATCH nf v7 0/1] " Zihan Xi
2026-10-11 11:28 ` [PATCH nf v7 1/1] " Zihan Xi
2026-10-11 14:58 ` Florian Westphal
2026-10-12 1:34 ` zihan xi
2026-10-14 7:35 ` zihan xi
2026-10-14 10:40 ` Florian Westphal [this message]
2026-10-14 11:10 ` 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=as9cKonuO_37jfA5@strlen.de \
--to=fw@strlen.de \
--cc=bsegall@google.com \
--cc=davem@davemloft.net \
--cc=dietmar.eggemann@arm.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jengelh@medozas.de \
--cc=juri.lelli@redhat.com \
--cc=kaber@trash.net \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=peterz@infradead.org \
--cc=phil@nwl.cc \
--cc=root@tr0jan.top \
--cc=rostedt@goodmis.org \
--cc=vega@nebusec.ai \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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
all inboxes | Powered by JetHome®