[RFC PATCH v9 27/29] docs: Document nsexec uAPI
From: Jarkko Sakkinen
Date: Mon Nov 30 2026 - 22:13:31 EST
Userspace orchestrators need a clear specification of what an nsexec
is, its build and live state transitions, NSEXEC_GET_NSFD,
NSEXEC_SHARE_NSFD, waitid(P_NSEXEC), pidfd_send_signal(), mount-tree
construction, user namespace ID mapping, credential rules, and process
creation semantics.
Add Documentation/userspace-api/nsexec.rst including the kernel-doc
sections, type definitions, ioctl descriptions, and system call
reference from include/linux/nsexec.h, include/uapi/linux/nsexec.h,
include/uapi/linux/nsfs.h, kernel/nsexec.c, kernel/user_namespace.c,
fs/fsopen.c, and fs/namespace.c, and register the nsexec ioctl magic
in ioctl-number.rst.
Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
---
Documentation/userspace-api/index.rst | 1 +
.../userspace-api/ioctl/ioctl-number.rst | 1 +
Documentation/userspace-api/nsexec.rst | 77 +++++++++++++++++++
3 files changed, 79 insertions(+)
create mode 100644 Documentation/userspace-api/nsexec.rst
diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
index a68b1bea57a8..e48d5081bbc2 100644
--- a/Documentation/userspace-api/index.rst
+++ b/Documentation/userspace-api/index.rst
@@ -17,6 +17,7 @@ System calls
:maxdepth: 1
unshare
+ nsexec
futex2
ebpf/index
ioctl/index
diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst
index dbe462040999..441e4925c9ac 100644
--- a/Documentation/userspace-api/ioctl/ioctl-number.rst
+++ b/Documentation/userspace-api/ioctl/ioctl-number.rst
@@ -385,6 +385,7 @@ Code Seq# Include File Comments
0xB8 01-02 uapi/misc/mrvl_cn10k_dpi.h Marvell CN10K DPI driver
0xB8 all uapi/linux/mshv.h Microsoft Hyper-V /dev/mshv driver
<mailto:linux-hyperv@xxxxxxxxxxxxxxx>
+0xB9 00-0F uapi/linux/nsexec.h nsexec uAPI
0xBA 00-0F uapi/linux/liveupdate.h Pasha Tatashin
<mailto:pasha.tatashin@xxxxxxxxxx>
0xC0 00-0F linux/usb/iowarrior.h
diff --git a/Documentation/userspace-api/nsexec.rst b/Documentation/userspace-api/nsexec.rst
new file mode 100644
index 000000000000..81d4352a01a5
--- /dev/null
+++ b/Documentation/userspace-api/nsexec.rst
@@ -0,0 +1,77 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===========
+nsexec uAPI
+===========
+
+Overview
+========
+
+.. kernel-doc:: kernel/nsexec.c
+ :doc: Overview
+
+Lifecycle
+=========
+
+.. kernel-doc:: include/linux/nsexec.h
+ :identifiers: nsexec_state
+
+Flags
+=====
+
+.. kernel-doc:: include/uapi/linux/nsexec.h
+ :identifiers: nsexec_flags
+
+Ioctls
+======
+
+.. kernel-doc:: include/uapi/linux/nsexec.h
+ :doc: NSEXEC_GET_NSFD
+
+.. kernel-doc:: include/uapi/linux/nsexec.h
+ :doc: NSEXEC_SHARE_NSFD
+
+System calls
+============
+
+.. kernel-doc:: kernel/nsexec.c
+ :identifiers: sys_nsexec_open
+
+Process creation
+================
+
+.. kernel-doc:: kernel/nsexec.c
+ :doc: CLONE_INTO_NSEXEC
+
+Process waiting
+===============
+
+.. kernel-doc:: kernel/nsexec.c
+ :doc: P_NSEXEC
+
+Signal delivery
+===============
+
+.. kernel-doc:: kernel/nsexec.c
+ :doc: pidfd_send_signal
+
+Filesystem configuration
+========================
+
+.. kernel-doc:: fs/fsopen.c
+ :doc: FSCONFIG_SET_NSEXEC
+
+Mount tree installation
+=======================
+
+.. kernel-doc:: fs/namespace.c
+ :doc: MOVE_MOUNT_T_MNTNS
+
+User namespace ID mapping
+=========================
+
+.. kernel-doc:: include/uapi/linux/nsfs.h
+ :identifiers: userns_idmap_extent userns_flags userns_idmap
+
+.. kernel-doc:: kernel/user_namespace.c
+ :identifiers: sys_userns_set_idmap
--
2.47.3