๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12138

Re: [PATCH 0/8] userns: per-namespace capability bounding set and opt-in netns loopback

#12138
From: Christian Brauner
Date: Fri, 06 Nov 2026 10:12
34 lines
9803 bytes
On Tue, Nov 03, 2026 at 06:37:46AM -0600, Serge E. Hallyn wrote:
> Kees whipped up a proof of concept BPF lsm that implemented this.  A copy
> from his email (and let's call it GPLv2 unless he wants to change it to
> something like MIT) follows:

There's no need to special-case user namespaces for this anymore.
I've added generic namespace LSM hooks for v7.4-rc1:

* namespace_init()
* namespace_install() (setns())
* namespace_free()

called from the common namespace code I added and for every namespace type.

So a policy like this can cover creation and setns() of all namespaces
and follow a namespace by its id until it's gone.

The catch is that what got merged doesn't work with the bpf LSM right
now.

namespace_free() is never called unless an LSM allocated a namespace
blob, namespace_init() sees a namespace id of zero because
the id is allocated after the hook has run, and the bpf LSM marks the
namespace arguments of both hooks as trusted although the namespace can
be freed right after.

I sent fixes for all of that (cf. [1], [2]) (cf. [3]).

[1]: https://lore.kernel.org/all/20261026-work-security-namespace_free-v1-0-ffa3ebbf71bd@kernel.org
[2]: https://lore.kernel.org/all/20261029-work-security-namespace_free-v2-0-65591dbba7b3@kernel.org
[3]: https://lore.kernel.org/all/CAHC9VhRwD1c1qKK4=Uc8cbMy27iF722C0DZeXy4WGtH-kOBOcQ@mail.gmail.com

-- 
Technical Details
Message-ID: <20261106-sandalen-monopol-neugierig-23357f8efc64@brauner>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357917-linux-kernel-netdev=dewy.ru
References: <20261028221705.3915340-1-halg@google.com> <aunVmg42/S2uUDWR@hallyn.com>

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-357917-linux-kernel-netdev=dewy.ru
From: brauner@kernel.org (Christian Brauner)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 0/8] userns: per-namespace capability bounding set and
 opt-in netns loopback
Date: Fri, 6 Nov 2026 11:12:53 +0100
Organization: Usenet Network
Message-ID: <20261106-sandalen-monopol-neugierig-23357f8efc64@brauner>
References: <20261028221705.3915340-1-halg@google.com>
 <aunVmg42/S2uUDWR@hallyn.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="3846238"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:65/l+egR3cADOsUi1F1LGsfE4sU= sha256:NppSCsoqmuyqRJXk9FoODSsBygqx/DJJJvBGx9NtjXs=
	sha1:OTazqPMa3+h7f3nbS7TcnFNoWfs= sha256:XWIOpHIgYlqh+ZVoqBCWpju4MNTcAFzG8zg83n0hACk=
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 E81F01131F9; Fri,  6 Nov 2026 13:23:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 EWco0Uw_VlWT;
	Fri,  6 Nov 2026 13:22:56 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-357917-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 00EBB1131D5; Fri,  6 Nov 2026 13:22:47 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 6C8762E023; Fri,  6 Nov 2026 10:13:10 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793959988;
	b=MXbozsXMzv9sUj6/vMfOIkrfaOSqTWPGBFTzuZkX8gxt3Z/d4Jc/aR7PFteycwcciz+Q
	 JlR61EaUYRbqMnyiW70GBCegZ7RYCcVGlISPMkqsnYhlhIYW+gGedhZf3+1j7SALFs/Bg
	 XiZOBvSz/R2aDDOUJkn9uJMfv6KB0xW0CYkLWKEe550sUfCvxZ4lZAw/l+fFK7r8hANyW
	 IK7Q6KtHKNmRPcnsDwFN8ksRKlGlXmHkN933SzkqF3vxuwt76kwhl7UbkIRR8D7QNPp9l
	 0gKqHZLjZ4mNQt6yoMSTs6Hcd68VZV2BK1hq1QOv8HDSkTDLKjNiHqqxP8PqRW1wy/g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793959988;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=nnzK0BslWJHcXFemGgfYITU9fhviw2smy0wN/ApAn14=;
	b=ifTvEDoJC6uh+GHC+LwWWiF1rg79dDMOqvXYRaAXMwXFMmmfggbMIeDC8RgldKCrfdvi
	 btyDBSfvDBm2qNMwG4XCTwDHcndt/EiIzdqbf3znacFrqVBnOgadufr33WtB/nUZk6SDG
	 ExKQVBjVOKkgjm6deIMpS7Vu/XoUq86YJk5ibaoNGBkA4+uG6yxw8cSpp+6vzKjezXkKb
	 nzJZO4MiVyzA7p36dDOoE2axDw8fe/mH26ij4pYJlpch2gtm4AYkkN2S1ajfTudrMcjlJ
	 G2UzNnd0LgLxJ2R6SEgGAirN0vAniwru2H4APrlbzIFg8yf0aPHQsHOGg9pqty/V0Qg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="edM4/p9S";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A7047606A339;
	Fri,  6 Nov 2026 10:13:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=edM4/p9S
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793959982;
	b=Z+MhnnWrt6JPuTP4JSsqIj1oHNViJpmCiEG3ua34SX2e2vVTzaTrlN4xnhsznOZ/Mp2w
	 TFIxz3FAcIioRTbsCYh9CBQNZ6WPT9Ok+h8pWPHRoEi2UXpXmcmDO5PDm5PVMuJP8Njrh
	 kWFEJ173bLe+0+vNJ5S+hwFA0pRMsYmhQyOIapPXNolRJe+wILJjX76D2ysY6i9PsNgp9
	 //Rz1heaAVG6idkoChhug24fOGgI7+3o89TLQA8wkbrGr+mDWKRXlLcC+jmz+UErUsosF
	 MU4ruTNuq1LgPE68OqBgM+ROofJUO4x1jr6QvBhizVegUy4rvKJvktpKKto8fBIOQfA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793959982;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=nnzK0BslWJHcXFemGgfYITU9fhviw2smy0wN/ApAn14=;
	b=hZc5LuKlOx2w2Rj9dJJVWrPOd+rMzUP8RYWAtuGiHC4aOjQowbicne2HE+A55E+sOXzH
	 ShEe1Q37OPzLq5XxuCXwfDHBqCzrZlNEbhHO8p2UYS/gwAccNrcyilJqxAuoU6UZQCrE5
	 NnqikgR5l+ROns1KftFoonDvbjHqnJpq+onv5lkp0Sb3j4jmenHD8DFYxmW1ZVtMh8Ghz
	 TU28JlcNj0Mt9pQ5Jzfdqcw162gxO+xghvhZa95EVpS82A+y9u0f7vpdlBGUc6LaQhmkl
	 ySipzs+g88lP9YHGk6KbJb79+nhrWnA48URkmAmuWJHtClwdu/PQNG3kV4L3NOpulAw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="edM4/p9S";
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54AFD606A326;
	Fri,  6 Nov 2026 10:13:02 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A44D81F0089F;
	Fri,  6 Nov 2026 10:12:55 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793959982;
	bh=nnzK0BslWJHcXFemGgfYITU9fhviw2smy0wN/ApAn14=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=edM4/p9SW7+S73fDgQfspXTjrIk9baHrV37Kd/QhylG3sLFrLKrn7Hstn6AQsz5uw
	 UpQitFXbsHcThZxWuXEdgx2CDWhWf6hbi4u2aagagDQcQos8ZBnDTihVAkxsA3Xn2S
	 DaXEaR4Ddkun5RuUbGazbbXXqJnn4U2NrjbxamgcSa5zL2fHatPp33S0Uil9R6wxXW
	 6ge5YPJC6yBuH0U/vS7kAmhEAxOiNR4kAK8TFOI7nFk/vAgdTcuJjqV3mfM6VrhrYp
	 EqVajW7CacXXOnIxA1xdsWgBIymxyAvUB9LHqQ8we47DuLvg13NGqZGYXr7xRTpXPl
	 +UVOBxUZErwXA==
X-Cc: Alexander Viro <viro@zeniv.linux.org.uk>, 
	Paul Moore <paul@paul-moore.com>, Serge Hallyn <sergeh@kernel.org>, Kees Cook <kees@kernel.org>, 
	"David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, 
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Jan Kara <jack@suse.cz>, 
	James Morris <jmorris@namei.org>, Simon Horman <horms@kernel.org>, 
	Jonathan Corbet <corbet@lwn.net>, Shuah Khan <skhan@linuxfoundation.org>, 
	Randy Dunlap <rdunlap@infradead.org>, Jann Horn <jannh@google.com>, 
	Gรผnther Noack <gnoack@google.com>, KP Singh <kpsingh@kernel.org>, 
	Jonathan Calmels <jcalmels@3xx0.net>, Casey Schaufler <casey@schaufler-ca.com>, 
	linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-api@vger.kernel.org, 
	containers@lists.linux.dev, netdev@vger.kernel.org, linux-doc@vger.kernel.org, 
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <aunVmg42/S2uUDWR@hallyn.com>