🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8641

[PATCH v2 6/7] lsm: fix the security_namespace_init() kernel-doc

#8641
From: Christian Brauner
Date: Thu, 29 Oct 2026 16:41
41 lines
10140 bytes
The kernel-doc claims that the owning user namespace is available via
ns->ops->owner(ns). But security_namespace_init() is called from
__ns_common_init() before the namespace has been set up. Apart from
network namespaces the owning user namespace isn't set at that point so
->owner() returns NULL. And for init_net with CONFIG_NET_NS=n ns->ops
itself is NULL.

What a namespace_init hook can rely on is the namespace type and, now
that it is allocated before the hook is called, the namespace id. So
document that instead.

No functional changes.

Fixes: f675d2e95569 ("lsm: add LSM blob and hooks for namespaces")
Cc: <stable@kernel.org> # mainline only
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
 security/security.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/security/security.c b/security/security.c
index 1e76c097b28d..81dac9e48a51 100644
--- a/security/security.c
+++ b/security/security.c
@@ -3382,9 +3382,9 @@ int security_create_user_ns(const struct cred *cred)
  * security_namespace_init() - Initialize LSM security data for a namespace
  * @ns: the namespace being initialized
  *
- * Initialize the LSM security blob attached to the namespace. The namespace type
- * is available via ns->ns_type, and the owning user namespace (if any)
- * via ns->ops->owner(ns).
+ * Initialize the LSM security blob attached to the namespace. The namespace
+ * hasn't been set up yet but its type and id are available via ns->ns_type
+ * and ns->ns_id.
  *
  * Return: Returns 0 if successful, otherwise < 0 error code.
  */

-- 
2.53.0
Technical Details
Message-ID: <20261029-work-security-namespace_free-v2-6-65591dbba7b3@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-353394-linux-kernel-netdev=dewy.ru
References: <20261029-work-security-namespace_free-v2-0-65591dbba7b3@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-353394-linux-kernel-netdev=dewy.ru
From: brauner@kernel.org (Christian Brauner)
Newsgroups: linux.kernel.netdev
Subject: [PATCH v2 6/7] lsm: fix the security_namespace_init() kernel-doc
Date: Thu, 29 Oct 2026 17:41:01 +0100
Organization: Usenet Network
Message-ID: <20261029-work-security-namespace_free-v2-6-65591dbba7b3@kernel.org>
References: <20261029-work-security-namespace_free-v2-0-65591dbba7b3@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2050520"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:0xKS6FlUwsuD1Ay6BuD+3ovLfWY= sha256:sXKX3n9a38vSpAsBFc9gIBL7Xg1y9f/WwRcHX3MQFD0=
	sha1:T8wxJKUby/K9CeA3fJ9tROtjp5A= sha256:n3nXS1JC5O6epxWzzNO0aHRc2CZuNCxkN0vwLkgLmDs=
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 81F8C125C6D; Thu, 29 Oct 2026 19:42:48 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[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 jmSJ4VbDAqXG;
	Thu, 29 Oct 2026 19:42:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-353394-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 26981125C69; Thu, 29 Oct 2026 19:42:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 7D177602D4D; Thu, 29 Oct 2026 16:41:49 +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=1793292094;
	b=N8rr2WPMnfAQ2LWrdoBS4vT4SULlA9EVXEU+KwFuhd6g8tN3Q0X7ol9N3qJZ+ljhWU5R
	 tMf/u1h+Lv9Ic85AurtU0v19PplSTXCAeEztKfFxyDxKCwZIjT5DTBZ4ZFOCafwJpUdAc
	 C5egfnwOY+TPxc69eRggitUcbL2/ak2lCHVhPt6j66zdd3ERx2xy0nL07DEGLSb/jTtg9
	 IosnrBG5GUqlHaVB7oUjkR26p07BrXMk88od2fMQJkdQaT8qvXtP1LrMYt13QYtvH9t7L
	 LhBdnGn9C/FUAQjVF9JDu3bxxD2fj81S5KcQwgAwJhw3syhcmoklBg4r02z1PxlN9sQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793292094;
	h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Developer-Signature:X-Developer-Key;
	bh=67EUHCtqjfB+tccUv3dsIzzhumxwNVJ2yslHfCYJQGw=;
	b=kDeM4M0JdCYgyJn+h00d5+YJ7DdS6WZoLwckj08D5WyjnLVYCDKfUmAsaeaJPQVjlS+0
	 9NbXoFHkkFmfPUAaf3r0aYnTOWfM0AqXJ4wpDthn1oxnAlLO83fCvIyUV4+ERtx+Du0hv
	 IuAAFo+sm2qvqC37eDQ7TdimnMwBdeG8//BMmtRVQncRnyCm+c+TDwYQEieLmG2xEIg8F
	 cFqjVpqQAkmPDxZkv8wslkG8s/c1h2A8q34o3ZNc+0sBftbvlrTxAwakEg7XI/pAKhQZ9
	 aDWjCrRKDnhsJFGBVmnX4oRO3PLvTKv69YPxi2oYKwPVtNZmLuLw6KGtzEBrwmZYy+A==
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=Xw6ZHbkE;
	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 AC5C8606A31F;
	Thu, 29 Oct 2026 16:41:34 +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=Xw6ZHbkE
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=1793292088;
	b=JtIqi+Zhi00Ydhh83Q87Hzcxwsk7owtE8teqmAKsCXZ+vGkDbPRihNn9yDzk2/+/7XWL
	 ZIDE5uVYtsTSMqroaxKyRLjCwsezzLeQtDxgllpn1U9St75cWZn2AAWpv18UqrjGSMJPw
	 SfuhIeHAPdZmL62mV9+ZkfGHzr12vuv7hNNw/SgMkoCI9TyQhj1zO+QXBwJCKLO3vQcfN
	 odK5N0bpNdN+mdiAZ19ketb5gW7Wje120bVWIFhq0E8QXUi4MsvPfEvp4eglZ4lLwPVgD
	 vL2hY6HvhxTU8RgWoWNXWvj5NHuhfLBZGz7mNv1IPV1VLuHFkvKh5Q+HNGKHPJLzkTQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793292088;
	h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Developer-Signature:X-Developer-Key;
	bh=67EUHCtqjfB+tccUv3dsIzzhumxwNVJ2yslHfCYJQGw=;
	b=JjbpWSE/J9Hr+nhuGLuZvbcBXDuBbKfNIi92QS9nmKXgmnytESuPlKw9RDqiykMLKvdE
	 finivJP4cufu/oSfHkldk3Zwu/vrPx6Q6VHyQt3ZgmHJOdP72+2VdVl5Qf5+JuVHNDK3R
	 I41tZCoijcDGpQE/ZxBM6eaOH9nv/MIzC5ub0Q4C5V/EDh3bp7mhj72TyvisQVEM76xm8
	 0jRa2dGfcr0jZg0mOEGh7Fnw/99tWn9mJ11SsgQo35fz2RDe2VkY3UtIoGBdzP6/9CFAF
	 jDLBtABDP9++ZdR2K0wrQBIQJIr7xBtDTzTZ9glsRoBJvgLOs0NKtQa3giqhvw0rDyw==
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=Xw6ZHbkE;
	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 8E35D606A33D;
	Thu, 29 Oct 2026 16:41:28 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82AC11F01816;
	Thu, 29 Oct 2026 16:41:25 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793292088;
	bh=67EUHCtqjfB+tccUv3dsIzzhumxwNVJ2yslHfCYJQGw=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=Xw6ZHbkEFUGlYZcgEYEkT5Z2AOxg+q8msKR94rB0I8id9fYqWFHd8VXng5aQCEIKd
	 Vdzqaf95Mfg25eIgtZJapL7w6gdmf98YvewMqBdkHOrRWOrZUwHFV6yFfPVMXRST3F
	 IRyGtVzMZ9M3O1BHNnN6bpEVpCIybZSDjLf/GHIUpD+F/814h1yT/VHuqppEVKwUMX
	 W7G3a9mGX7/Wt0fVoXU+vP8c82x7oGdZTRd6ckS/MzuFFAOu9SBFB0AoOewplxoZrB
	 YMvqOS49jIUyM9Plhj5eAplSWHqvg+hanw5KOKomQIISjXXtL8tFDpA5uo9Hmhw3vH
	 bie+D0NogZQcw==
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: <20261029-work-security-namespace_free-v2-0-65591dbba7b3@kernel.org>
X-Cc: linux-security-module@vger.kernel.org, 
 Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, 
 Paul Moore <paul@paul-moore.com>, 
 Mickaël Salaün <mic@digikod.net>, 
 Günther Noack <gnoack@google.com>, netdev@vger.kernel.org, 
 Linus Torvalds <torvalds@linux-foundation.org>, 
 "Christian Brauner (Amutable)" <brauner@kernel.org>, stable@kernel.org
X-Mailer: b4 0.17-dev-ce4c1
X-Developer-Signature: v=1; a=openpgp-sha256; l=1633; i=brauner@kernel.org;
 h=from:subject:message-id; bh=LU/y2L5eVemTv0E47phbRKaXIXa34YzJQ/j0ZrgeaAA=;
 b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWQ9Lpc/l33tR/cyqb/pey/I1Ra8+ZOoeMWix9tC+iwLb
 3pzZ3ZpRykLgxgXg6yYIotDu0m43HKeis1GmRowc1iZQIYwcHEKwESMTjAy7NzzUba0XzMmceqk
 Uoey1A0z1zY9+ij+WT99lezu179+pTMybD/waE9bmgnzrCaJV7Pk9MtfuZ6aofqWd17D1Wr+8Oz
 3DAA=
X-Developer-Key: i=brauner@kernel.org; a=openpgp;
 fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624