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=1796441210; b=z4T2DS5EkmpmbeDDDrcnfcRJanaocXq0TZG6FkpAa//LakjY1925k/9BmBLeRGR+4p2A Ipm0PY58F3fAfH/spi0vnCa6+ahC6BrPc/FXQvjXAgcWYAdKOlED93Mwi/6f30fCEguhB 5RFT2ZxaCb7Xq7XWFtagIQa55qsQ7zaACQV0zR0OcphjkkhNPtKQKimR2kI4rEMzVKn3t Xnx4Po67+mHcQ7+Jjj4Y3jTDKohWjRwnbxkYka3dxoLBkaDvpDcqWoUwSaJ9qWJdGD4Nx W+5gJ1f2wsIL9Z8+9e/qai1Iywr7hhTClMY99ujysSGMqqFVA9mD2LSTMMPiSj+N0ow== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796441210; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=4jTnkJeD+/7uOPv85o0uFtm9EzJf6xHhLe/dO45Acm8=; b=xoeXHL0yd8EENLz2mDtrwh1NrnulwrXZvPn8Yo+RlXgiU2uLIRtD2oXsVNoJiTbxslib SOHeBpk7RIbUcCrqTxSbOvMEDJYj93ppiHP/vWthrWQOZj+ePQHQU6xDA/weluk50yL0N EFIynhdN5qG9W6ti9hvcaCXzmndL1zaRc/7kcyyRrZB8/54AdTEvUaqcG1qQiTDkKVVl2 ZanFqJEJ/XB0kNfA4RzLMM8+cBpWrALLvtu03I7wqaJbt/nsa2nCDQS96i1FSJHvmO63n 1fOW6E4+AFlCRXhOkX8Qvi3GsCT/tGUh8SMhQCvR/o0hYyGV1Hz7uMc2Drs5+L9h5vA== 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=TsRpOY25; 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 8BAF4606A322; Sat, 5 Dec 2026 03:26:50 +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=TsRpOY25 Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 8D58F1F00A11; Sat, 5 Dec 2026 03:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796441210; bh=4jTnkJeD+/7uOPv85o0uFtm9EzJf6xHhLe/dO45Acm8=; h=From:To:Cc:Subject:Date; b=TsRpOY25uiXX+5FfruA9AEaGvGzAZoY2sRyacs++x7HWbeUco2UYMQfsupvJxzVFE TNtE4GArZ7HX23xgpFXyauI/XdTRiLl/wXI1d1PX2QX0B5p8frFD3Nxcj7kBtpA6C2 BhlJyMm3zEKmx9nHqttvGHvmzyXwhSZo3MksfwPgbv4CxLEznlcMXZdFx1upYx6Y68 RCuhHCaNH/9fPerZbPILhNogTJj7Z7uZS63EBUphQ1zFcenqbKZnosjyem2XFRp3lK DZnVoWC6juk+48YR+2R3i1Zji1aYSPGmWpDsULjr6NkQ3omJYRXMKGn9VixH48qTY5 +cZErVFjm8m5A== 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 v10 00/28] runfd: Staged namespace execution Date: Sat, 5 Dec 2026 05:26:05 +0200 Message-ID: <20261205032633.1702772-1-jarkko@kernel.org> X-Mailer: git-send-email 2.47.3 X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OVERVIEW ======== The previous approaches, including David's original patches and Cells, have an off-by-one architectural flaw. They model the "ship", while actually the target should be the "dock". The launch and its concurrency properties is the focal point. For me this target was obvious from SGX, and overall on how to manage more abstract payloads where it makes sense to focus on launch rather than the object being launched. The latter is a dragon's tail and destined to ultimate failure. It's also noteworthy that runfd is not a subsystem of any existing subsystem. It has only caller- or callback-relations. I.e., it is fully decoupled from decision making and architecture of namespaces, and does not introduce any constraining bottlenecks. MOTIVATION ========== Self-modifying uninitialized state in containers is probably one of the biggest security challenges we have at the moment. The primitives for namespaces, credentials, and mounts were designed to be invoked from inside the process being isolated, one step at a time. Container runtimes and sandboxes (runc, systemd-nspawn, bubblewrap, etc.) approach the problem with a chain of short-lived helper processes, which are managed by pausing them behind pipes or socket pairs. While this is happening, the parent process does the whole shebang of obscure management tasks: 1. Writes /proc//uid_map and /proc//gid_map. 2. Clones the host's entire mount table only to tear it back down with pivot_root() and fork yet again before PID 1 can finally call execve(). runc has one of the worst-case scenarios in this regard given that the Go runtime is always multi-threaded. This disallows calling unshare(CLONE_NEWUSER | CLONE_NEWNS) or setns(CLONE_NEWUSER) directly from Go. The workaround addressing this is based on a C trampoline. I.e., packing the cargo happens exactly at the time when the ship is lifting the anchor and detaching from the harbor, and with the current syscall API there's no common-sense way around this. This also complicates authenticated measurement: a measurement of one setup step does not describe the final environment. OVERVIEW ======== If the root of the problem is that an isolated process has to assemble its own prison from the inside while already running, the natural alternative is to invert the sequence: construct the entire execution environment from the outside while it is still inert, and only spawn a process once setup is complete. Building on David Howells' earlier work on kernel container objects [1], this series introduces runfd: an anonymous-inode control descriptor that splits namespace setup and process execution into distinct build and live phases. The kernel provides the launch mechanism for one container run, not a container model. OCI runtimes still decide what to run and how to configure it. Calling runfd() allocates a fresh user namespace together with a detached set of mount, PID, UTS, IPC, network, cgroup, and (where enabled) time namespaces. Crucially, the mount namespace starts completely empty (CLONE_EMPTY_MNTNS) rather than cloning the caller's mount table, and no task exists inside any of the new namespaces during the build phase (RUNFD_INIT). Because the caller's own credentials, root directory, and thread group are never mutated during construction, even a multi-threaded runtime such as Go can drive the entire setup directly over file descriptors without helper processes or C trampolines. Rather than introducing a parallel namespace API, runfd plugs into existing descriptor-based syscalls for ID mapping, filesystem configuration, mount placement, process creation, waiting, and signaling. SOLUTION ======== The standalone primitives at the front of the series (patches 01-08) make both user namespaces and mount namespaces configurable via nsfs file descriptors without a paused child task, while the remaining patches tie them together around the run lifecycle. 1. Allocating namespaces and programming ID maps ------------------------------------------------ A manager begins by calling runfd(), which returns a close-on-exec control descriptor in RUNFD_INIT. While in this build phase, the manager can substitute existing cgroup, IPC, UTS, network, or time namespaces with RUNFD_SHARE_NSFD, or obtain nsfs descriptors for member namespaces with RUNFD_GET_NSFD. Instead of formatting text into /proc//uid_map and gid_map while a helper blocks on a pipe, the NS_SET_IDMAP ioctl installs UID, GID, and project ID extents atomically on the user namespace descriptor. The caller can request USERNS_SETGROUPS_ALLOWED when installing a GID map: run_fd = runfd(RUNFD_AUTOKILL); userns_fd = ioctl(run_fd, RUNFD_GET_NSFD, CLONE_NEWUSER); mntns_fd = ioctl(run_fd, RUNFD_GET_NSFD, CLONE_NEWNS); struct userns_idmap_extent ext = { .first = 0, .lower_first = 1000, .count = 1, }; struct userns_idmap map = { .nr_uid_extents = 1, .nr_gid_extents = 1, .uid_extents = (__u64)(uintptr_t)&ext, .gid_extents = (__u64)(uintptr_t)&ext, }; ioctl(userns_fd, NS_SET_IDMAP, &map); Parent ID ranges are authorized against the ioctl caller, allowing an unprivileged runtime to pass userns_fd over SCM_RIGHTS to a privileged mapping helper without keeping an embryonic child alive. 2. Assembling the mount tree without pivot_root() ------------------------------------------------- With ID mappings in place, superblocks can be instantiated directly inside the run's user, network, PID (proc), and IPC (mqueue) namespaces by binding a mount-API context via FSCONFIG_SET_RUN. Filesystems opt into unprivileged delegation with FS_RUN_MOUNT (tmpfs, ramfs, devpts, proc, and mqueue) or FS_USERNS_DELEGATABLE. To populate the empty mount namespace without entering it, move_mount() learns two flags: MOVE_MOUNT_T_MNTNS resolves to_dfd as a mount namespace descriptor (attaching "/" onto its nullfs root once, and resolving relative paths beneath that root thereafter), and MOVE_MOUNT_CLONE recursively bind-clones a source tree without requiring OPEN_TREE_CLONE or CAP_SYS_ADMIN in the caller's mount namespace. CAP_SYS_ADMIN is checked in the target mount namespace's owning user namespace: fs_fd = fsopen("tmpfs", FSOPEN_CLOEXEC); fsconfig(fs_fd, FSCONFIG_SET_RUN, NULL, NULL, run_fd); fsconfig(fs_fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0); root_fd = fsmount(fs_fd, FSMOUNT_CLOEXEC, 0); mkdirat(root_fd, "usr", 0755); move_mount(root_fd, "", mntns_fd, "/", MOVE_MOUNT_F_EMPTY_PATH | MOVE_MOUNT_T_MNTNS); move_mount(AT_FDCWD, "/usr", mntns_fd, "usr", MOVE_MOUNT_T_MNTNS | MOVE_MOUNT_CLONE); Mounts crossing user namespace boundaries are locked with MNT_LOCKED, and AppArmor mediates MOVE_MOUNT_CLONE as MS_BIND | MS_REC. The same MOVE_MOUNT_T_MNTNS path remains available after boot for live mount hotplug, which workloads can observe via fanotify(FAN_MNT_ATTACH) and statmount(). 3. Spawning PID 1 and supervising the lifecycle ----------------------------------------------- Once "/" has been installed, clone3() with CLONE_INTO_RUN spawns the first child directly into the configured environment as PID 1, transitioning the descriptor from RUNFD_INIT through RUNFD_FORKING to RUNFD_RUNNING: struct clone_args args = { .flags = CLONE_INTO_RUN, .runfd = run_fd, }; pid = clone3(&args, sizeof(args)); if (pid == 0) execve("/sbin/init", argv, envp); waitid(P_RUNFD, run_fd, &info, WEXITED); Subsequent CLONE_INTO_RUN calls join the running PID namespace directly for management or diagnostic sessions. To prevent half-transitioned task state, CLONE_VM, CLONE_FILES, CLONE_FS, and CLONE_SIGHAND are rejected; when the caller originates outside the target user namespace, exec_state->user_ns stays anchored in that outer namespace with dumpability reset to suid_dumpable until execve(), blocking member tasks from tracing the child or reading /proc//{exe,mem,fd}. At runtime, pidfd_send_signal() broadcasts signals across member thread groups, poll() reports EPOLLHUP once PID 1 exits and the PID namespace is reaped, and waitid(P_RUNFD) reads init's exit status without consuming it. Run LSM hooks cover allocation, namespace sharing, process entry, and signaling. Landlock checks namespace sharing and entry, and the hooks are also available to BPF LSM. RESOURCES ========= [1] https://lwn.net/Articles/780364/ [2] https://github.com/jarkkojs/systemd/tree/main [3] https://github.com/jarkkojs/bubblewrap/tree/main [4] https://github.com/jarkkojs/podman/tree/main [5] https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/ucells.git/ [6] https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd-test.git/ CHANGES ======= v10: - Reduced to *SINGLE* new syscall. - Rename nsexec_open() to runfd() and update the related interface names. - Replace userns_set_idmap() with the NS_SET_IDMAP ioctl on the user namespace descriptor. - Drop the in-tree nsexec selftests and package the standalone ucells runner in the Buildroot runfd image. - Include the runfd kernel-doc in the userspace API manual and register the ioctl range in a separate patch. v9: - The main theme is the refactorization of userland_open() into nsexec() and rewriting the cover letter to be focused on execution rather than data structures, as latter should be only consequence of the former. - Rewrite the kselftest as a seed-replayable model-based fuzzer. - Rename userland to nsexec across syscalls, ioctls, clone3(), waitid(), fsconfig(), LSM hooks, documentation, selftests, and MAINTAINERS. - Rename USERLAND_KILL_ON_CLOSE to NSEXEC_AUTOKILL and drop USERLAND_CLOEXEC in favor of unconditional O_CLOEXEC on nsexec_open(). - Recheck CAP_SYS_ADMIN on fc->user_ns after ->set_nsexec(), gate FSCONFIG_SET_NSEXEC on CONFIG_NSEXEC, preserve proc and mqueue namespaces on FS_CONTEXT_FOR_RECONFIGURE, and validate proc gid= against fc->user_ns via fsparam_gid(). - NOTE: Despite the patch set size grows, the feature size does not, which is about 2400 lines added and 260 removed. This patch set is dominated by the Python test suite (for a good reason). v8: - Pass MOVE_MOUNT_* flags to security_move_mount(), mediate MOVE_MOUNT_CLONE as MS_BIND | MS_REC in AppArmor, and enforce Landlock namespace restrictions on userland entry and sharing (Sashiko). - Move USERLAND_ALL_FLAGS out of uAPI, rename USERLAND_CLOSE_ON_EXEC to USERLAND_CLOEXEC, drop unused userland_copy(), userland_exit(), and fsconfig_set_userland() code, and reset exec_state->dumpable whenever exec_state->user_ns originates outside the target user namespace (Sashiko, Askar Safin). - Fix sys_userns_set_idmap() kernel-doc range syntax and document CLONE_INTO_USERLAND pre-execve() ptrace_may_access() isolation (Sashiko, Askar Safin). - Route unshare() and setns() via ctypes for Python 3.9 compatibility, isolate /tmp mount propagation when running as root, and derive the E2BIG buffer size from SC_PAGE_SIZE in selftests/userland (Sashiko). v7: - Move userland_copy() outside tasklist_lock, loop in userland_waitid() across bootstrap retries, defer fsmount() may_mount() on userland_bound contexts, and clean up mount/idmap helpers (Sashiko). - Move userland.rst prose into modular kernel-doc comments, document ->set_userland() in mount_api.rst, and harden selftests/userland for x32/i386, CONFIG_TIME_NS=n, and SOCK_SEQPACKET fd passing (Sashiko). v6: - Rename rootns to userland, replace ROOTNS_WAIT and ROOTNS_KILL ioctls with waitid(P_USERLAND) and pidfd_send_signal(), and add USERLAND_SHARE_NSFD plus security_userland_share(). - Gate FSCONFIG_SET_USERLAND on FS_USERLAND_MOUNT, pass USERNS_SETGROUPS_ALLOWED via syscall flags, bound userns_set_idmap() size to PAGE_SIZE, and tighten mount and pidns checks (Sashiko). v5: - Split standalone fd-based user and mount namespace setup ahead of core control object patches, and add userns_set_idmap() (Andy Lutomirski) plus MOVE_MOUNT_CLONE. v4: - Consolidate control syscalls into an anonymous-inode fd, add LSM hooks and bpf_lsm wiring, disallow CLONE_VM, and rewrite kselftests in Python (Sashiko). v3: - Replace MOVE_MOUNT_T_ROOTNS_ROOT with MOVE_MOUNT_T_MNTNS, add GET_NSFD ioctl, and support unprivileged FSCONFIG_SET_ROOTNS mount configuration (Andy Lutomirski, Sashiko). v2: - Rely on user_namespace ownership for setns() isolation and replace rootns_enter() with clone3() entry (Andy Lutomirski). VERSIONS ======== v9: https://lore.kernel.org/linux-fsdevel/20261201031002.593830-1-jarkko@kernel.org/ v8: https://lore.kernel.org/linux-fsdevel/20261128235808.2369970-1-jarkko@kernel.org/ v7: https://lore.kernel.org/linux-fsdevel/20261122193539.3334213-1-jarkko@kernel.org/ v6: https://lore.kernel.org/linux-fsdevel/20261122011809.2667684-1-jarkko@kernel.org/ v5: https://lore.kernel.org/linux-fsdevel/20261121000844.1863324-1-jarkko@kernel.org/ v4: https://lore.kernel.org/linux-fsdevel/20261119224312.1037966-1-jarkko@kernel.org/ v3: https://lore.kernel.org/linux-fsdevel/20261118193539.240065-1-jarkko@kernel.org/ v2: https://lore.kernel.org/linux-fsdevel/20261117231352.3816603-1-jarkko@kernel.org/ v1: https://lore.kernel.org/linux-fsdevel/20261117050841.3289652-1-jarkko@kernel.org/ Cc: bpf@vger.kernel.org Cc: containers@lists.linux.dev Cc: linux-api@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Cc: linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-kselftest@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-security-module@vger.kernel.org Cc: Aleksa Sarai Cc: Alexander Mikhalitsyn Cc: Alexander Viro Cc: Alexei Starovoitov Cc: Andrew Morton Cc: Andrii Nakryiko Cc: Andy Lutomirski Cc: Arnd Bergmann Cc: Baolin Wang Cc: Ben Segall Cc: Christian Brauner Cc: Daniel Borkmann Cc: David Hildenbrand Cc: David Howells Cc: David Woodhouse Cc: Davidlohr Bueso Cc: Dietmar Eggemann Cc: Eduard Zingerman Cc: Emil Tsalapatis Cc: Eric Biggers Cc: Georgia Garcia Cc: Giuseppe Scrivano Cc: "Günther Noack" Cc: Hugh Dickins Cc: Ihor Solodrai Cc: Ingo Molnar Cc: James Morris Cc: Jan Kara Cc: Jason Gunthorpe Cc: Jarkko Sakkinen Cc: Jeff Layton Cc: Jiri Olsa Cc: John Johansen Cc: Jonathan Corbet Cc: Josef Bacik Cc: Juri Lelli Cc: Kees Cook Cc: K Prateek Nayak Cc: KP Singh Cc: Kumar Kartikeya Dwivedi Cc: Lennart Poettering Cc: "Liam R. Howlett" Cc: Manfred Spraul Cc: Martin KaFai Lau Cc: Matt Bobrowski Cc: Mel Gorman Cc: Michal Hocko Cc: "Mickaël Salaün" Cc: Mickaël Salaün Cc: Mike Rapoport Cc: Neal Gompa Cc: Oleg Nesterov Cc: Paul Moore Cc: Pavel Tikhomirov Cc: Peter Zijlstra Cc: Randy Dunlap Cc: "Serge E. Hallyn" Cc: Serge Hallyn Cc: Shuah Khan Cc: Song Liu Cc: Stephen Smalley Cc: Steven Rostedt Cc: Valentin Schneider Cc: Vincent Guittot Cc: Yonghong Song Cc: Zygmunt Krynicki Jarkko Sakkinen (28): userns: Factor out idmap validation and commit helpers userns: Add NS_SET_IDMAP ioctl mount: Add mnt_ns_get_root() mount: Enforce mount_too_revealing() for foreign mntns mount: Support MOVE_MOUNT_T_MNTNS in move_mount() security: Pass flags to security_move_mount() mount: Support MOVE_MOUNT_CLONE with MOVE_MOUNT_T_MNTNS apparmor: Mediate MOVE_MOUNT_CLONE as recursive bind userns: Factor out install_user_ns_cred() nsproxy: Expose create_new_namespaces() runfd: Add core infrastructure runfd: Track init lifecycle via copy_process() and pid_namespace runfd: Add runfd() system call runfd: Add RUNFD_GET_NSFD ioctl runfd: Add RUNFD_SHARE_NSFD ioctl exit: Support P_RUNFD in waitid() signal: Support run fds in pidfd_send_signal() fork: Support CLONE_INTO_RUN in clone3() fs: Support FSCONFIG_SET_RUN in fsconfig() proc: Implement ->set_run() fs_context operation ipc/mqueue: Implement ->set_run() fs_context operation security: Add run LSM hooks landlock: Enforce namespace use restrictions on run bpf: Register run LSM hooks arch: Wire up runfd() system call ioctl: Register the runfd ioctl range docs: Include runfd kernel-doc in the userspace API manual MAINTAINERS: Add entry for RUNFD Documentation/filesystems/mount_api.rst | 35 +- Documentation/userspace-api/index.rst | 1 + .../userspace-api/ioctl/ioctl-number.rst | 1 + Documentation/userspace-api/runfd.rst | 77 ++ MAINTAINERS | 10 + arch/alpha/kernel/syscalls/syscall.tbl | 1 + arch/arm/tools/syscall.tbl | 1 + arch/arm64/tools/syscall_32.tbl | 1 + arch/m68k/kernel/syscalls/syscall.tbl | 1 + arch/microblaze/kernel/syscalls/syscall.tbl | 1 + arch/mips/kernel/syscalls/syscall_n32.tbl | 1 + arch/mips/kernel/syscalls/syscall_n64.tbl | 1 + arch/mips/kernel/syscalls/syscall_o32.tbl | 1 + arch/parisc/kernel/syscalls/syscall.tbl | 1 + arch/powerpc/kernel/syscalls/syscall.tbl | 1 + arch/s390/kernel/syscalls/syscall.tbl | 1 + arch/sh/kernel/syscalls/syscall.tbl | 1 + arch/sparc/kernel/syscalls/syscall.tbl | 1 + arch/x86/entry/syscalls/syscall_32.tbl | 1 + arch/x86/entry/syscalls/syscall_64.tbl | 1 + arch/xtensa/kernel/syscalls/syscall.tbl | 1 + fs/devpts/inode.c | 8 +- fs/filesystems.c | 15 + fs/fs_context.c | 21 +- fs/fsopen.c | 131 ++- fs/internal.h | 7 +- fs/namespace.c | 373 +++++++-- fs/nsfs.c | 9 + fs/pnode.c | 39 +- fs/pnode.h | 3 +- fs/proc/root.c | 61 +- fs/ramfs/inode.c | 2 +- include/linux/cred.h | 4 +- include/linux/fs.h | 1 + include/linux/fs_context.h | 6 + include/linux/lsm_hook_defs.h | 10 +- include/linux/lsm_hooks.h | 3 + include/linux/mnt_namespace.h | 2 + include/linux/nsfs.h | 1 + include/linux/nsproxy.h | 8 +- include/linux/pid_namespace.h | 4 + include/linux/runfd.h | 136 ++++ include/linux/sched/task.h | 6 + include/linux/security.h | 43 +- include/linux/syscalls.h | 1 + include/linux/user_namespace.h | 20 +- include/uapi/asm-generic/unistd.h | 6 +- include/uapi/linux/mount.h | 5 +- include/uapi/linux/nsfs.h | 49 ++ include/uapi/linux/runfd.h | 55 ++ include/uapi/linux/sched.h | 5 + include/uapi/linux/wait.h | 1 + init/Kconfig | 10 + ipc/mqueue.c | 31 +- kernel/Makefile | 2 + kernel/bpf/bpf_lsm.c | 11 + kernel/cred.c | 20 +- kernel/exit.c | 4 + kernel/fork.c | 85 +- kernel/nsproxy.c | 15 +- kernel/pid_namespace.c | 2 + kernel/runfd.c | 761 ++++++++++++++++++ kernel/signal.c | 4 + kernel/sys_ni.c | 3 + kernel/user_namespace.c | 434 +++++++--- mm/shmem.c | 5 +- scripts/syscall.tbl | 1 + security/apparmor/include/mount.h | 2 +- security/apparmor/include/path.h | 1 + security/apparmor/lsm.c | 4 +- security/apparmor/mount.c | 50 +- security/apparmor/path.c | 6 +- security/apparmor/policy_unpack.c | 6 +- security/landlock/fs.c | 3 +- security/landlock/ns.c | 63 +- security/lsm_init.c | 6 + security/security.c | 79 +- security/selinux/hooks.c | 2 +- tools/include/uapi/asm-generic/unistd.h | 6 +- .../perf/arch/arm/entry/syscalls/syscall.tbl | 1 + .../arch/mips/entry/syscalls/syscall_n64.tbl | 1 + .../arch/powerpc/entry/syscalls/syscall.tbl | 1 + .../perf/arch/s390/entry/syscalls/syscall.tbl | 1 + tools/perf/arch/sh/entry/syscalls/syscall.tbl | 1 + .../arch/sparc/entry/syscalls/syscall.tbl | 1 + .../arch/x86/entry/syscalls/syscall_32.tbl | 1 + .../arch/x86/entry/syscalls/syscall_64.tbl | 1 + .../arch/xtensa/entry/syscalls/syscall.tbl | 1 + tools/scripts/syscall.tbl | 1 + 89 files changed, 2536 insertions(+), 265 deletions(-) create mode 100644 Documentation/userspace-api/runfd.rst create mode 100644 include/linux/runfd.h create mode 100644 include/uapi/linux/runfd.h create mode 100644 kernel/runfd.c base-commit: 2076c0591c1f232f3c1e6ce047f189bcf59610b4 -- 2.47.3