From: Florian Westphal <fw@strlen.de>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
pablo@netfilter.org, phil@nwl.cc, eric@regit.org,
Yu Junzhe <junzheyu1@gmail.com>
Subject: Re: [PATCH nf] netfilter: nft_reject: prevent unbounded recursion in output hooks
Date: Tue, 22 Sep 2026 08:18:49 +0200 [thread overview]
Message-ID: <arIdrbUtZyaH7QbQ@strlen.de> (raw)
In-Reply-To: <20260921222925.3874-1-fmancera@suse.de>
Fernando Fernandez Mancera <fmancera@suse.de> wrote:
> nftables payload-mangling rules can rewrite packet contents (such as TCP
> flags) before they are evaluated by reject targets. This defeats the
> content-based loop guards, allowing unbounded hook recursion that leads
> to kernel stack exhaustion and panics.
>
> Fix this by extracting the per-CPU xmit recursion limit previously used
> by the netdev duplication/forwarding paths into a shared header, and
> apply it to the inet and inet6 reject transmit functions. It disables BH
> while transmitting the skb to address a possible migration to different
> CPU leading to imbalanced decrementation of the recursion counters.
>
> Note that the dev_queue_xmit() path used when CONFIG_BRIDGE_NETFILTER is
> enabled does not require this recursion guard. In that scenario, the
> generated reset packet is transmitted directly at Layer 2. Because the
> packet egresses from a different hook, it cannot synchronously loop.
Won't nf_send_unreach() / unrach6 need the same guard?
If not, please explain why those are safe, its not clear to me.
Patch looks good otherwise, thanks Fernando.
next prev parent reply other threads:[~2026-09-22 6:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 22:29 [PATCH nf] netfilter: nft_reject: prevent unbounded recursion in output hooks Fernando Fernandez Mancera
2026-09-22 6:18 ` Florian Westphal [this message]
2026-09-22 9:05 ` Fernando Fernandez Mancera
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=arIdrbUtZyaH7QbQ@strlen.de \
--to=fw@strlen.de \
--cc=coreteam@netfilter.org \
--cc=eric@regit.org \
--cc=fmancera@suse.de \
--cc=junzheyu1@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/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.