From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DF5D606A339 for ; Tue, 1 Dec 2026 03:11:37 +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 kanga.kvack.org (Postfix) id 4CBC06B05C1; Mon, 30 Nov 2026 22:11:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 47B756B05C2; Mon, 30 Nov 2026 22:11:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2CEBA6B05C3; Mon, 30 Nov 2026 22:11:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DEA196B05C1 for ; Mon, 30 Nov 2026 22:11:16 -0500 (EST) Received: from smtpin17.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A3356160D3C for ; Tue, 1 Dec 2026 03:11:15 +0000 (UTC) X-FDA: 85493938110.17.152B913 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf24.hostedemail.com (Postfix) with ESMTP id 08B4B180004 for ; Tue, 1 Dec 2026 03:11:13 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=KNiiWZEM; spf=pass (imf24.hostedemail.com: domain of jarkko@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=jarkko@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796094674; b=bqjzrNXU09epKIjD9kzjd8Iox01SzeG79LMBMU924LFzHifZUBtlXnv3CT85xPp28bNIHv FOAu5Y6/f1/kLinvK7qmn0WBrLQABwN15n/eXvoy8m6c8cEWsgKUBQ68+NuEyU5gytdfep wMlYGFmTZNAg333M9TnL9E1T54vyzCM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796094674; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HpMpOTJbeA8Fm3zBRtj4LWDBXmpYlDVM/4qwTWTUTh8=; b=WeODOZuzTm9IeQ/3HXsRYXeS7YbOcwSq7E+l4zMO2IMtgshhXMFoc6kaGEQuEdmt0jWZXj fZG2xexPsICo3H+m4YM0xNHYakjHU+vEDcP+3fspf1W5SgwaJ4NP5APWW0H0kEY40+RxKP 8A1RYxb9Kap2FnJZx6DaQm8LKr3lQHw= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=KNiiWZEM; spf=pass (imf24.hostedemail.com: domain of jarkko@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=jarkko@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with UTF8SMTP id 8D7D562044; Tue, 1 Dec 2026 03:11:13 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 08B4B180004 X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Stat-Signature: 9t61xghyypk1ohojsndr5xdcpuq5msxu X-HE-Tag: 1796094673-750972 X-HE-Meta: U2FsdGVkX18tlJZi95Noou4m+el3Rm/JRJFwxnjNjoycESJsmQa/w4gQd4i++FvseHvBaJ/gxsSkC8LLBcwKjWup9p1pC0dLCU3dKbwDUT7pJTYM0/t3XALyTSBI4vqkYirmeRgX8ahBwwC5H6+HJxvhTDyAXLNr+SvOvBFKNZ4V8LIEMzGRnmIB2+CqDoG51ic2LmgooItDFuFYbmL5fEkAQcCFMmVKFfgx0fQSFozGOqGz6g8qiRZJK9xDDt08mdAf68gydoyDu3lhOn2txbieUDRniQuDSa2EHh62qFgxQLh9qbNj23rJCUiV5hFFaavnoiVDwrmoFeo3ELKFQpbTCr+E1WYT26rDuBSfZ2vKPBENuuxQNGhYQbLfVhsM/4UwPKfVyCeMWjpF4B9+MJeQ0qIp/P1oDD6LhkSFUwSuUwKktswMwrrlkzIa9lDwMb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sYOnWZQj9+rW0rkA0s4T/kGmJBHQ== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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