πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #4745

Re: [PATCH net-next 04/15] netfilter: nf_queue: limit the hook drop flush to the unregistered hook point

#4745
From: Florian Westphal
Date: Mon, 19 Oct 2026 04:49
62 lines
6964 bytes
netdev-bot+sashiko@kernel.org <netdev-bot+sashiko@kernel.org> wrote:

@Antonio: TL;DR: if Pablo wants a v2, please send a new patch that adds
the needed nf_queue_nf_hook_drop() calls in brnf and conntrack.

Otherwise, please followup after this hits net-next tree.

> - [High] Use-after-free of module code: after this patch, `rmmod
>   br_netfilter` no longer drops queued packets that point into…
> - [Medium] Conntrack module unload can now stall on queued packets, and
>   the commit message does not mention it.
> - [Low] The commit message has no Fixes: tag.
> 
> --
> 
> [Severity: Low]
> Should this have a Fixes: tag?

Absolutely NOT.

> Without the trailer, stable maintainers may miss this fix. The message
> also does not say the omission is deliberate.

This is NOT a fix.  And the problems highlight that this belongs
in -next and not in stable trees.

> [Severity: High]
> After this change, can packets whose okfn points into br_netfilter.ko stay
> queued after that module is unloaded?

Yes, br nf strikes again.

> Is a flush-all, such as nf_queue_nf_hook_drop(net, NULL), needed in the
> br_netfilter exit path, or some other flush at module teardown for callers
> whose okfn is module code?

Yes, needs to be added for brnf.  Could be handled as a followup,
though, ample of time to fix this until this gets into a non-rc kernel.

> [Severity: Medium]
> Could rmmod nf_conntrack now block while userspace holds verdicts for
> queued packets?
>
> Before this patch, that unregistration flushed every queued entry. This
> released the nf_conn references held through skb->_nfct.
> 
> This runs while pernet_ops_rwsem is held for write. Netns creation and
> teardown would stall until a verdict is sent or the queue socket is
> closed.
> 
> The commit message says nf_ct_iterate_destroy() keeps the NULL flush on
> module exit. That path covers helpers and NAT, not nf_conntrack itself,
> and the message does not mention this case.

> Should nf_conntrack's exit path also flush with NULL?

Yes, nf_conntrack_fini_net() would be a candiate.

But unlike the brnf case I think this one is relatively harmless.

If v2 wanted: add
Technical Details
Message-ID: <atWhayNce2rqLQUL@strlen.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348289-linux-kernel-netdev=dewy.ru
References: <20261018005638.1776148-5-pablo@netfilter.org> <179237288267.3135.9555179349652175002@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348289-linux-kernel-netdev=dewy.ru
From: fw@strlen.de (Florian Westphal)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 04/15] netfilter: nf_queue: limit the hook drop
 flush to the unregistered hook point
Date: Mon, 19 Oct 2026 06:49:47 +0200
Organization: Usenet Network
Message-ID: <atWhayNce2rqLQUL@strlen.de>
References: <20261018005638.1776148-5-pablo@netfilter.org>
 <179237288267.3135.9555179349652175002@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3508865"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2Z6qkv2IpFhggFWPqZUYTPgRqko= sha256:RWjoBDSdWh8j/QWNv2iEBU4ics0P6LmLuZDamlU2z7s=
	sha1:+jrqaUsDhL5DJhjbd0vKnzmReJM= sha256:T+OnO/2bvBXRu+Uw+dAMymKQl8oqUFcR0zmGlIg9qaY=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 89237110915; Mon, 19 Oct 2026 07:50:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id Y3XUt5bti66D;
	Mon, 19 Oct 2026 07:50:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-348289-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=strlen.de
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 085E2110904; Mon, 19 Oct 2026 07:50:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sin.lore.kernel.org (Postfix) with ESMTP id C34832713F; Mon, 19 Oct 2026 04:49:59 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id F13B1483825;
	Mon, 19 Oct 2026 04:49:56 +0000 (UTC)
X-Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BB32481ABB;
	Mon, 19 Oct 2026 04:49:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.216.245.30
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792385396; cv=none; b=bRFePXNXnTiIRWz7OVZddgQkzL67guVOBxz/oIG7FxD/j8h1CZKBcWpFS/Um1JP+44uTb5Y0KjpnWRBCPh7iUAk2l9yBNL8RbARWzyw3Ba9xoonuxJFQw8CK9W/tRoAKBbsstj30Z37b2uI1P0TGqOz9wn0Kp/tQBYFTW5R24N0=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792385396; c=relaxed/simple;
	bh=ke6NDE0gtn25bpqFitqWZ7wDU0VL/NWKOAqy7Bt20ng=;
	h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To; b=D0UshUMdcD3RWGiG8woLgWT6/jPsW0SIoGX+/JNUz/my8xwvHFElyx/hkqTJmoXpZMSvUeTyTTdpGIzp3AvDw0isi/l5LqgyR69zV3pkpqV/YurOvQDjtYGxKE568ZjyVtH0kLGDVIMEAKNfUq+NAZixId+3HiVDQAOKvwOrOCw=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=none smtp.client-ip=91.216.245.30
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strlen.de
X-Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)
	id 0087D60272; Mon, 19 Oct 2026 06:49:47 +0200 (CEST)
X-Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org,
	davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@kernel.org, horms@kernel.org, ja@ssi.bg
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <179237288267.3135.9555179349652175002@kernel.org>