[RFC PATCH v6 24/26] docs: Document userland uAPI
From: Jarkko Sakkinen
Date: Sat Nov 21 2026 - 20:21:24 EST
Userspace orchestrators need a clear specification of what a userland
is, its build and live state transitions, USERLAND_GET_NSFD,
USERLAND_SHARE_NSFD, waitid(P_USERLAND), pidfd_send_signal(), mount-tree
construction, user namespace ID mapping, credential rules, and process
creation semantics.
Add Documentation/userspace-api/userland.rst to include the kernel-doc
sections, ioctl descriptions, and system call reference from
kernel/userland.c, kernel/user_namespace.c,
include/uapi/linux/userland.h, include/uapi/linux/nsfs.h, fs/fsopen.c,
and fs/namespace.c, and register the userland 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/userland.rst | 73 +++++++++++++++++++
3 files changed, 75 insertions(+)
create mode 100644 Documentation/userspace-api/userland.rst
diff --git a/Documentation/userspace-api/index.rst b/Documentation/userspace-api/index.rst
index a68b1bea57a8..ac665b8fea72 100644
--- a/Documentation/userspace-api/index.rst
+++ b/Documentation/userspace-api/index.rst
@@ -17,6 +17,7 @@ System calls
:maxdepth: 1
unshare
+ userland
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..4cf194e7b648 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/userland.h userland 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/userland.rst b/Documentation/userspace-api/userland.rst
new file mode 100644
index 000000000000..47d5c39ccb1c
--- /dev/null
+++ b/Documentation/userspace-api/userland.rst
@@ -0,0 +1,73 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=============
+userland uAPI
+=============
+
+Overview
+========
+
+A userland is an anonymous-inode control object opened by ``userland_open()`` (not
+an ``nsfs`` namespace) that binds a detached namespace set, an initially empty
+mount namespace, an owning user namespace, and an init process lifecycle across
+build (``USERLAND_INIT``) and live (``USERLAND_RUNNING`` / ``USERLAND_DEAD``) phases.
+
+Flags
+=====
+
+.. kernel-doc:: include/uapi/linux/userland.h
+ :identifiers: userland_flags
+
+Ioctls
+======
+
+.. kernel-doc:: include/uapi/linux/userland.h
+ :doc: USERLAND_GET_NSFD
+
+.. kernel-doc:: include/uapi/linux/userland.h
+ :doc: USERLAND_SHARE_NSFD
+
+System calls
+============
+
+.. kernel-doc:: kernel/userland.c
+ :identifiers: sys_userland_open
+
+Process creation
+================
+
+.. kernel-doc:: kernel/userland.c
+ :doc: CLONE_INTO_USERLAND
+
+Process waiting
+===============
+
+.. kernel-doc:: kernel/userland.c
+ :doc: P_USERLAND
+
+Signal delivery
+===============
+
+.. kernel-doc:: kernel/userland.c
+ :doc: pidfd_send_signal
+
+Filesystem configuration
+========================
+
+.. kernel-doc:: fs/fsopen.c
+ :doc: FSCONFIG_SET_USERLAND
+
+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