From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796094674; b=lkTwp+mcBBbXyDeqWvpKtSBWjsZy9yMSAQ0qWnGkPEMeG8mP947MAQGGEVdjFCLhIQln CbKwl9Fp6wW5Tcl4znlrodA+Y0K8KIcUAshtPMHnuVnnHynJOwb0LumKOw3fZngQ9ZzQG k3mGlitAyf/7l/jdm5JjID4im0ZNpMkQFoLzovmkXFZzeQZCGeloHnVi0UlOsboXs5MnZ HloJYlJVwahOpj/RbNNjz0wefK6WHLI7UN3z8eqmYrcvUWduw3P3S2AaZJwkbmX4iXjPn 7FlR7NbBO3j4C+e0AULrTxXX8GXguQmjvzmZ7vSlEkPdC0ZiQr/9b7kvXDCeWglET/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796094674; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=HpMpOTJbeA8Fm3zBRtj4LWDBXmpYlDVM/4qwTWTUTh8=; b=BgL8lyRwBlCtQ72B+rxH2V1iayusrOegv0ZjmvfSxCd/5LBV6r/1LZNAh6QHbiSgELaj Od7LuVgsGtPTA8Got7bDxHSRRkPE1v4+dVXkJoG5F/RUUqIYWWUPQme0kHG+RbzAZ0vCL 0oyT25Dzp2dogjFZsmE/8v35ukzNY4LN40jAvKBZaoQ5b8yo+v1qpQMo1gJPRNvc2rXGB /ZE9d9JG6RaQli+CkrUKr2EL5ehE4pKxZqgY+C1gCDR5Bmur3arkEaiBe7YN6cciBjHV2 YrwU6sL1EMRc7tnSQd6msSNnQfJcSsKsCxN9DGh6rMi1z01qY09q23Q3dzDCdxgOEew== 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=KNiiWZEM; arc=none smtp.remote-ip=100.103.45.18 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 UTF8SMTPS id 976BE606A31A; Tue, 1 Dec 2026 03:11:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KNiiWZEM Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 22E461F00897; Tue, 1 Dec 2026 03:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796094672; bh=HpMpOTJbeA8Fm3zBRtj4LWDBXmpYlDVM/4qwTWTUTh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KNiiWZEMCGJrY4Fh1aqXmn075tolCo8yQp+0pajCj4tP469PhEPNdAVo/p/ZKSoSA c0PlVk7aHzarn9PQds0aZ7GTpLquxwXCz+CwA+7syoPySVt/nl0ivumFrFYNigIgVB 3sSTE8skaNLZjGJ03BB+SvchSANY4vhuYuiAiaMHENunzx8X2VMqtXbNlGn5aJ/xob XtSJZr06GXYZCcWbkDf+Jbzr+bOsDIZrA0RXfLFSf/M3ydtPLXcJ+8o2i/OKMp11A4 ZFhCvalo8MRYt5AMaeZrkVQO3gAynxCkX3dU6jfJl2fgIt3lKja8Lj4LGR99GMBWNB 0dA9nNlcY/+qQ== From: Jarkko Sakkinen To: fsdevel@vger.kernel.org Cc: Jarkko Sakkinen , bpf@vger.kernel.org, containers@lists.linux.dev, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, Aleksa Sarai , Alexander Mikhalitsyn , Alexander Viro , Alexei Starovoitov , Andrew Morton , Andrii Nakryiko , Andy Lutomirski , Arnd Bergmann , Baolin Wang , Ben Segall , Christian Brauner , Daniel Borkmann , David Hildenbrand , David Howells , David Woodhouse , Davidlohr Bueso , Dietmar Eggemann , Eduard Zingerman , Emil Tsalapatis , Eric Biggers , Georgia Garcia , Giuseppe Scrivano , =?UTF-8?q?G=C3=BCnther=20Noack?= , Hugh Dickins , Ihor Solodrai , Ingo Molnar , James Morris , Jan Kara , Jason Gunthorpe , Jeff Layton , Jiri Olsa , John Johansen , Jonathan Corbet , Josef Bacik , Juri Lelli , Kees Cook , K Prateek Nayak , KP Singh , Kumar Kartikeya Dwivedi , Lennart Poettering , "Liam R. Howlett" , Manfred Spraul , Martin KaFai Lau , Matt Bobrowski , Mel Gorman , Michal Hocko , =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Mike Rapoport , Neal Gompa , Oleg Nesterov , Paul Moore , Pavel Tikhomirov , Peter Zijlstra , Randy Dunlap , "Serge E. Hallyn" , Serge Hallyn , Shuah Khan , Song Liu , Stephen Smalley , Steven Rostedt , Valentin Schneider , Vincent Guittot , Yonghong Song , Zygmunt Krynicki Subject: [RFC PATCH v9 11/29] nsproxy: Expose create_new_namespaces() Date: Tue, 1 Dec 2026 05:09:43 +0200 Message-ID: <20261201031002.593830-12-jarkko@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261201031002.593830-1-jarkko@kernel.org> References: <20261201031002.593830-1-jarkko@kernel.org> X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit create_new_namespaces() is currently static to kernel/nsproxy.c, preventing callers outside kernel/nsproxy.c from constructing a child nsproxy without mutating a task. Expose create_new_namespaces() in so nsexec_open() can allocate a detached namespace set from current. Co-developed-by: David Howells Signed-off-by: David Howells Signed-off-by: Jarkko Sakkinen --- include/linux/nsproxy.h | 4 ++++ kernel/nsproxy.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index dc2447f5f092..d611c40cb4ce 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h @@ -12,6 +12,7 @@ struct ipc_namespace; struct pid_namespace; struct cgroup_namespace; struct fs_struct; +struct user_namespace; /* * A structure to contain pointers to all per-process @@ -92,6 +93,9 @@ static inline struct cred *nsset_cred(struct nsset *set) * */ +struct nsproxy *create_new_namespaces(u64 flags, struct task_struct *tsk, + struct user_namespace *user_ns, + struct fs_struct *new_fs); int copy_namespaces(u64 flags, struct task_struct *tsk); void switch_cred_namespaces(const struct cred *old, const struct cred *new); void exit_nsproxy_namespaces(struct task_struct *tsk); diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index 2dcf105e8ee2..3c4161515c3c 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -85,9 +85,9 @@ void deactivate_nsproxy(struct nsproxy *ns) * Return the newly created nsproxy. Do not attach this to the task, * leave it to the caller to do proper locking and attach it to task. */ -static struct nsproxy *create_new_namespaces(u64 flags, - struct task_struct *tsk, struct user_namespace *user_ns, - struct fs_struct *new_fs) +struct nsproxy *create_new_namespaces(u64 flags, struct task_struct *tsk, + struct user_namespace *user_ns, + struct fs_struct *new_fs) { struct nsproxy *new_nsp; int err; -- 2.47.3