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 CF99A606A6B3 for ; Sat, 28 Nov 2026 23:59:12 +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=TOn8BcT+ Received: by kanga.kvack.org (Postfix) id 7A21D6B05C1; Sat, 28 Nov 2026 18:59:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 77A186B05C2; Sat, 28 Nov 2026 18:59:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6696C6B05C3; Sat, 28 Nov 2026 18:59:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 424086B05C1 for ; Sat, 28 Nov 2026 18:59:05 -0500 (EST) Received: from smtpin25.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B38C7140620 for ; Sat, 28 Nov 2026 23:59:04 +0000 (UTC) X-FDA: 85486196208.25.0E7F4AA Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf06.hostedemail.com (Postfix) with ESMTP id 12BF9180005 for ; Sat, 28 Nov 2026 23:59:02 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=TOn8BcT+; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of jarkko@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=jarkko@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1795910343; b=Pgwn/XOFs1e3AQ+fWbEo54WLb+Fk9GMMrN6/OF9MBM3khpuCHzFg5WAJYU+U9ZFBgTreDl qT2POTDcV5dRQhc2nOanioW+qDkaODKnG2HRbXx/If4CJcP2ExF643GUTA0X3prDGorC5r wPbLLI+VZmhUBuQqX4FTCvPvfvfed5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1795910343; 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=ujYt3pxK39YV6xgrJ9ycAzI8XphJxsY1pHf5v0/Q8cY=; b=gerL6oBOlYSsih0KONsd47qaDrKJAqE91RjDuaM3ASj3OLqhTk2dUThD4Sn64uYiJn6G6Z o9sc5XK1bBOUC1hb2InfcFqASBXSEstRO92MSB4SbzvY9r9Gzrm93YOfWan6faVHN4Bhiw NaKmwAt+GqMovwf9NTCkHxuJ2j5VUHs= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=TOn8BcT+; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of jarkko@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=jarkko@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with UTF8SMTP id 2F6E74029B; Sat, 28 Nov 2026 23:59:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 614031F00899; Sat, 28 Nov 2026 23:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795910342; bh=ujYt3pxK39YV6xgrJ9ycAzI8XphJxsY1pHf5v0/Q8cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TOn8BcT+ijwtTD/vKJ5qB+6u3OcXPW6sBsz9EggqQP5s1mVCHVPU9wbnmdcU055R8 TPKEVmiOSnlcWtg8xoHgSDrE47IsosNtKmmqopkiOw9X61fVXduLeSqNGdiG5n/aq/ GFpzvd/38Va9xdQaSKP0k205fcK8qBVmF68AZb5CuJqCv2rmWzAOIOjHDQbj+H6dVv XqUxLoZX0qRm7y9vb3Xhsd85dBh2yOYhunHWP7AK914GHEDyHn4Zf5g3MLNk0FC1kc 7rtE/bSG1rdtAkA44oCqzawM9E477ikXjChQb5SAeNxW5xHZezK1ndQ6ThavLfc0G8 izVZKh9seOxLw== 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-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 , Andy Lutomirski , Arnd Bergmann , Christian Brauner , David Howells , Eric Biggers , Georgia Garcia , Giuseppe Scrivano , Hugh Dickins , James Morris , Jan Kara , Jeff Layton , John Johansen , Jonathan Corbet , Josef Bacik , Kees Cook , KP Singh , Lennart Poettering , Matt Bobrowski , =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Neal Gompa , Oleg Nesterov , Paul Moore , Pavel Tikhomirov , Serge Hallyn , Shuah Khan , Stephen Smalley , Zygmunt Krynicki Subject: [RFC PATCH v8 11/29] nsproxy: Expose create_new_namespaces() Date: Sun, 29 Nov 2026 01:57:50 +0200 Message-ID: <20261128235808.2369970-12-jarkko@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261128235808.2369970-1-jarkko@kernel.org> References: <20261128235808.2369970-1-jarkko@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 12BF9180005 X-Stat-Signature: bysnuwdyqwbwmaedsm5pgtwhkhuskxp6 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-HE-Tag: 1795910342-213279 X-HE-Meta: U2FsdGVkX1/xyKe+rCYfXOcDQYxO/9mgQMHssc05qdVNxTRx4zUhzYoqXORVK0bDMmdAHyTIAadMOd8DTqm5F6YzcTcj6kBjXL6+rw40g6Evs49bam2XDKGHt3kLWH+NDmeVn64DKLqF0b2UX/bMG2GdYVd46wzbD2sX9Ey+24QoELgdem5WfSkPiToqbdF2/4R4J8ZfsTvSEVj+PEi5t8IlXiHjd7veKx+q9kpoWW2ZCsVrK4wa5SoYtZg3Bk4czjhHyHH+EgBB48lCwPjKglb5bzGHh359zroxw8fUJ/ofnxRS6zJPDAzECw5dR24AZVo7hXxIpvNlxN33Q3U/TnfqhKWmD6hwECvp662pAoFKmSGhanWvsMv9j0PKlptS4yk7ECKF4yO0hovJPXyiOnE4EUbDGuO7gD4CHlFH1VqfigN3TFlQNsomhjvzXoErPnGcrfnU0bzfXRVqLih+evfCzX4rDblS2uKwbNM6CeLPwJYz9L6OInvGWu7GhQGAZ59fhr8F7gnNm5WO0MEGNg1GzSgftTzQ2VF6yFwgD8RCgBFkuJ70yscU2zt7tOmC5fo5xZrm8eQCisMgQ5ZbsnS8jjCJRS3Rb0G453eNrK/oX4/ix+HzgJ0ysWzDn6K3uK197VQ7K7DFdz1fk2Viwd/k48ENs2pK9hrL/p6XLXCddZdzr0/sKFKmqchJVokBLTsGXkJzUFFwg3l3e6iGrhl4vg67PMiU9cv6pw2vL90Sc10Gpnkz9bVk37mX9YKhLZYQ7Dfi4NMKa5BUiS+w/3kvpnp0mj6tyY/vsDd31V+e995KoDLomQN8RA/IPecY/jE5pmOMzZnwtA9M9vUaa18Xq52qLLl53M60KAR0i/DnIyIA4w2OVQUDtA0FuqE9+yHVTFbXEuzjyJuDNu4w0dy7fp3sni9ysV/SjeMtFzdA2szVWRBCT7MS7jWm7Nj2UUekxNNAPCMhHfyHzPh uVVY9OuA mtC3wlufHHPdDEOBtubO+NXBu2o7HovtVwvrh3U7dENIKsE9p9IQOTvOOTfTUhevSU9Nz0AZVxsrYaFEiUVXLKOYnMEe4zugkMV92DLVrjg8FwvdYYICP3R3b7afBFged96eJnc8MUXFDrBB94pltuFSHUbqzpBRB/+xETmU/aZHe2pASU/89GBi9oi336uHsOlXe4mmwjyJw849PVuvmo2PLsTppcet8tM1rOFPhup9lylNFGBJN8SgLEJvseVeRVAnhqyX6Kvbt00fCpDrmFa287CQhvddAq86Aij/u5GJEYhEnnVCI4JCJVwqEXaDUvHht84uuSifDQMyHoL5a5LvnMIJqNIMeFzDkpfFTkOf5fqb6gbQIQr3kY7qkXT7AdxuAgg4lz5UXtGstlR4c1XaE5fLWjL0XjZnozmAlU6jCszT3ntDWM9GBIoOsg8iH1ujmiuT8Po5n6uphLXnCXiOz3/8ddsRrwoGVgKdBiUd3G2hdV8umWnaWql7k5cfo0TsSEzc8js6mNvHExMGYGGxmvQYFweO8rzR94iBTgRwXIzvZDBpwTjNDYZS3VkfJh0Ec 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 userland_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