Netdev List
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@kernel.org, horms@kernel.org,
	fw@strlen.de, ja@ssi.bg
Subject: [PATCH net 02/10] netfilter: xt_IDLETIMER: restrict to init_net
Date: Mon, 30 Nov 2026 22:51:33 +0100	[thread overview]
Message-ID: <20261130215141.1009148-3-pablo@netfilter.org> (raw)
In-Reply-To: <20261130215141.1009148-1-pablo@netfilter.org>

From: Zhiling Zou <zhilinz@nebusec.ai>

IDLETIMER keeps its timer registry, reference counts, and sysfs files in
module-global state, while Xtables invokes checkentry and destroy for
rules in individual network namespaces. A matching label from another
namespace can therefore reuse and control an existing timer.

The sysfs interface is global and cannot represent per-namespace labels
with the current target design. Reject IDLETIMER rules outside init_net
so that global state stays in the namespace it was built for.

Fixes: 0902b469bd25 ("netfilter: xtables: idletimer target implementation")
Cc: stable@vger.kernel.org
Reported-by: Vega <vega@nebusec.ai>
Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/xt_IDLETIMER.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c
index 71b78b5da698..2449c091cdf6 100644
--- a/net/netfilter/xt_IDLETIMER.c
+++ b/net/netfilter/xt_IDLETIMER.c
@@ -28,6 +28,7 @@
 #include <linux/kobject.h>
 #include <linux/workqueue.h>
 #include <linux/sysfs.h>
+#include <net/net_namespace.h>
 
 struct idletimer_tg {
 	struct list_head entry;
@@ -308,6 +309,9 @@ static int idletimer_tg_checkentry(const struct xt_tgchk_param *par)
 	struct idletimer_tg_info *info = par->targinfo;
 	int ret;
 
+	if (!net_eq(par->net, &init_net))
+		return -EOPNOTSUPP;
+
 	ret = idletimer_tg_helper(info);
 	if(ret < 0)
 		return -EINVAL;
@@ -341,6 +345,9 @@ static int idletimer_tg_checkentry_v1(const struct xt_tgchk_param *par)
 	struct idletimer_tg_info_v1 *info = par->targinfo;
 	int ret;
 
+	if (!net_eq(par->net, &init_net))
+		return -EOPNOTSUPP;
+
 	if (info->send_nl_msg)
 		return -EOPNOTSUPP;
 
-- 
2.47.3


  parent reply	other threads:[~2026-11-30 21:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 21:51 [PATCH net,v2 RESEND 00/10] Netfilter fixes for net Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 01/10] netfilter: conntrack: prevent helper extension relocation Pablo Neira Ayuso
2026-11-30 21:54   ` netdev-bot+sinfo
2026-11-30 21:56     ` Pablo Neira Ayuso
2026-11-30 21:51 ` Pablo Neira Ayuso [this message]
2026-11-30 21:51 ` [PATCH net 03/10] netfilter: synproxy: prevent unbounded recursion in transmit path Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 04/10] netfilter: conntrack: wait for RCU readers before freeing the hash Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 05/10] netfilter: nft_synproxy: only handle pure SYN and ACK packets Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 06/10] netfilter: conntrack: limit master chain depth Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 07/10] netfilter: conntrack: skip unconfirmed entries in /proc/net/nf_conntrack Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 08/10] netfilter: bridge: detach conntrack template on invalid IP frames Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 09/10] netfilter: synproxy: fix double tsoff application in server ACK TSecr Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 10/10] netfilter: nf_tables: only disable tables on a dormant transition Pablo Neira Ayuso

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=20261130215141.1009148-3-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=ja@ssi.bg \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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