Netdev List
 help / color / mirror / Atom feed
From: Ma Xinmeng <1564938642@qq.com>
To: pablo@netfilter.org, fw@strlen.de
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, phil@nwl.cc
Subject: Re: [PATCH net] netfilter: nf_tables: don't unregister hooks that were never registered
Date: Tue, 17 Nov 2026 17:21:00 +0800	[thread overview]
Message-ID: <tencent_1EE75BCD1429860DD8309301916DB83ECC0A@qq.com> (raw)
In-Reply-To: <tencent_19A48DA487BBFCFD990AC5A8010C663EA007@qq.com>

Hi,

This issue was found by FuzzAnything's AI-assisted kernel fuzzer while
fuzzing nftables netlink messages in a user and network namespace. I
reduced the sequence to a standalone raw-netlink C PoC and checked the
mechanism against the kernel source.

I triggered the WARN at runtime on Linux 7.3.0-rc4, 7.3.1, 7.4-rc1,
7.4-rc2, and 7.4-rc3. The baseline stack from 7.4.0-rc3-c027test #4
(the signature is the same on the other versions) is:

  hook not found, pf 2 num 3
  WARNING: net/netfilter/core.c:522 at __nf_unregister_net_hook+0x71/0x1b0, CPU#0: repro_c027470f/1087
  CPU: 0 UID: 0 PID: 1087 Comm: repro_c027470f Not tainted 7.4.0-rc3-c027test #4
  Call Trace:
    nft_table_disable+0x78/0xa0
    nf_tables_commit+0x1c03/0x1ec0
    nfnetlink_rcv_batch+0x939/0xaf0
    nfnetlink_rcv+0x190/0x1b0

The sequence uses only valid nftables netlink messages: create a table
with DORMANT|PERSIST|OWNER, close the owning socket (PERSIST clears OWNER
but keeps the dormant table), add an IPv4 basechain while the table is
dormant (its hook is not registered), then re-own the orphan with
DORMANT|PERSIST|OWNER. On commit, nf_tables_table_disable() clears
DORMANT before walking the basechains. __nf_tables_unregister_hook()
then bypasses its dormant guard and calls nf_unregister_net_hook() for a
hook that was never registered. This is WARN-only; with
panic_on_warn=1 it becomes a local DoS.

After applying the candidate patch to 7.4-rc3, the same PoC returns 0
and dmesg has no WARN. The A/B test also passed on 7.3.1 and 7.4-rc2.

Thanks,
Ma Xinmeng


      parent reply	other threads:[~2026-11-17  9:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  8:54 [PATCH net] netfilter: nf_tables: don't unregister hooks that were never registered Ma Xinmeng
2026-11-17  9:03 ` netdev-bot+sinfo
2026-11-17  9:21 ` Ma Xinmeng [this message]

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=tencent_1EE75BCD1429860DD8309301916DB83ECC0A@qq.com \
    --to=1564938642@qq.com \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox