Article View: linux.kernel.netdev
Article #4696Re: [PATCH net-next 01/15] netfilter: disable br_netfilter in user namespaces
From: netdev-bot+sashiko
Date: Mon, 19 Oct 2026 01:21
Date: Mon, 19 Oct 2026 01:21
83 lines
8322 bytes
8322 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] tools/testing/selftests/net/netfilter/br_netfilter_queue.sh
re-execs itself under `unshare -n` (line 40) and then runs `sysctl…
--
netfilter: disable br_netfilter in user namespaces
This commit disables br_netfilter in network namespaces that are not
owned by init_user_ns. In those namespaces it skips registration of the
bridge-nf sysctls and of the br_netfilter hooks. It also adds a boot-time
warning that the module is slated for removal in 2027, and updates the
bridge documentation to match.
> diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
> index 0a394e5f43916..e15355ff215a7 100644
> --- a/net/bridge/br_netfilter_hooks.c
> +++ b/net/bridge/br_netfilter_hooks.c
[ ... ]
> static int __net_init brnf_init_net(struct net *net)
> {
> + if (net->user_ns != &init_user_ns) {
> + struct brnf_net *brnet = net_generic(net, brnf_net_id);
> +
> + brnet->in_userns = true;
> + pr_warn_once("br_netfilter no longer supported in user namespaces\n");
> + return 0;
> + }
> +
> return br_netfilter_sysctl_init_net(net);
> }
[Severity: Medium]
Should tools/testing/selftests/net/netfilter/br_netfilter_queue.sh be
updated along with this change?
That script re-execs itself in a new netns via unshare -n. The new netns
inherits the caller's user namespace:
[ "${1}" != "run" ] && { unshare -n "${0}" run; exit $?; }
It then treats a missing sysctl as a hard failure:
modprobe -q br_netfilter
sysctl net.bridge.bridge-nf-call-iptables=1 || exit 1
Suppose the selftests run inside a non-initial user namespace, for
example a rootless container or a CI job under unshare -r. Then the
netns created by unshare -n has user_ns != &init_user_ns, and
brnf_init_net() returns before registering the sysctls. The sysctl
write fails and the script exits 1, so the test reports FAIL instead of
SKIP.
Before this patch the sysctl was present and writable by userns root,
so the test passed in that environment.
The sibling test br_netfilter.sh already treats the same condition as a
skip:
if ! ip netns exec "$ns0" sysctl -q net.bridge.bridge-nf-call-iptables=1; then
echo "SKIP: bridge netfilter not available"
ret=$ksft_skip
fi
Could br_netfilter_queue.sh use the same handling and exit with
$ksft_skip here?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261018005638.1776148-2-pablo%40netfilter.org
Technical Details
Message-ID:
<179237288041.3135.11774275051307629447@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348223-linux-kernel-netdev=dewy.ruReferences:
<20261018005638.1776148-2-pablo@netfilter.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-348223-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 01/15] netfilter: disable br_netfilter in user namespaces Date: Mon, 19 Oct 2026 01:21:20 +0000 Organization: Usenet Network Message-ID: <179237288041.3135.11774275051307629447@kernel.org> References: <20261018005638.1776148-2-pablo@netfilter.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3476335"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ZZf+VzL49OUETuiOgoF75cavuYI= sha256:DNhFLfMrKZnrLU1ZZty7r6p57Jbmf1uj3h7bMkV0gAY= sha1:9TczooBh+WQyAcIa6bnEc7ohZdk= sha256:EunAtS06SQ4o3wZpYOI297U/K7PjWDbIIWrMezc7DiE= 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 9A1211108D6; Mon, 19 Oct 2026 04:23:05 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.74 X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.34, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 tbII72_08ISV; Mon, 19 Oct 2026 04:23:02 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348223-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 51DCF110892; Mon, 19 Oct 2026 04:22:53 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 289883532D; Mon, 19 Oct 2026 01:21:23 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CDC9E31280D; Mon, 19 Oct 2026 01:21:22 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kcTeZ0r0" X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 ADB30253951; Mon, 19 Oct 2026 01:21:21 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792372882; cv=none; b=fbkHxplNhie0w+VHa/AGgP3PyTp1aL4+Y31u9suwYS/l1cQMvUlYqawkjMU/EMYzznkOAvhmIeZi5t3RnjEY6dBwkYj1/k3q0WhiRXdhxrd1J8/1ItraXWHJBeM2dbE7hQsQhVuLU5LrFmZmCFcRorPlUftNebcqbg0iNy3a8UQ= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792372882; c=relaxed/simple; bh=3Ir8TP71k1No72mzl+a2aflk/XS3VTqfJ00gJ3yVlJ8=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=Dw3xYUT/VpHyatJUjjI05rPicml+qQuNTYanhu5WfUx+CWuU2aW8mAIsuKTogmru6k1Xhd8viJQdPJMWz5azAB56em8PGHVxs20Wn7fHn/u54VUz59luzULGMvO234GaiSd1IJKZcl2Z6enxYEK2fdvUiLF41kELRx8d9gTOPHA= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kcTeZ0r0; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD6C11F000C4; Mon, 19 Oct 2026 01:21:20 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792372881; bh=BaoUA/IiB69pw5+i5a25POFMR2S2myjx3y6u+M5wcw8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=kcTeZ0r08fSCiNizJiDxkHgA+kLrVQ4yoy0p8aPXDfMurZYLmVmqMKLdb9Yl2qcqg 4OKQUqmteLSqkGn5/oxeS8oYalw967nLY8ryxfaTBnJ27XdWiLKaf7D10whkVassxB ULbpohMjqEwdbMKNw4gvaXLAmkufiAZBKjTilBrpBJal6M5lE1ZlDh/42thNz4IZec LkVDcJQXrWE5c6P5gPJOiKTY126LoV2jnA2AgxCOJMjz0hPkA/D1UA4S8mjtDFe8ZF hjJZtHyjb2uN8QdyJGtsuovzF0VCcrUn6N/wO5Mmpvjw/PvsRMa4W7/+QvWc/UBpvB 5aX7E2FRZbY0A== X-Cc: netfilter-devel@vger.kernel.org, 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 X-In-Reply-To: <20261018005638.1776148-2-pablo@netfilter.org> X-sashiko-severity: Medium 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>