mirror-linux/include
Christian Brauner a1d220d9da
nsfs: iterate through mount namespaces
It is already possible to list mounts in other mount namespaces and to
retrieve namespace file descriptors without having to go through procfs
by deriving them from pidfds.

Augment these abilities by adding the ability to retrieve information
about a mount namespace via NS_MNT_GET_INFO. This will return the mount
namespace id and the number of mounts currently in the mount namespace.
The number of mounts can be used to size the buffer that needs to be
used for listmount() and is in general useful without having to actually
iterate through all the mounts. The structure is extensible.

And add the ability to iterate through all mount namespaces over which
the caller holds privilege returning the file descriptor for the next or
previous mount namespace.

To retrieve a mount namespace the caller must be privileged wrt to it's
owning user namespace. This means that PID 1 on the host can list all
mounts in all mount namespaces or that a container can list all mounts
of its nested containers.

Optionally pass a structure for NS_MNT_GET_INFO with
NS_MNT_GET_{PREV,NEXT} to retrieve information about the mount namespace
in one go. Both ioctls can be implemented for other namespace types
easily.

Together with recent api additions this means one can iterate through
all mounts in all mount namespaces without ever touching procfs.

Link: https://lore.kernel.org/r/20240719-work-mount-namespace-v1-5-834113cab0d2@kernel.org
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-08-09 12:46:59 +02:00
..
acpi - Unrelated x86/cc changes queued here to avoid ugly cross-merges and 2024-07-15 19:36:01 -07:00
asm-generic asm-generic updates for 6.11 2024-07-16 12:09:03 -07:00
clocksource
crypto
drm Merge tag 'drm-intel-next-2024-06-28' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next 2024-07-10 10:36:47 +02:00
dt-bindings - New Drivers 2024-07-17 17:42:20 -07:00
keys
kunit kunit: Introduce KUNIT_ASSERT_MEMEQ and KUNIT_ASSERT_MEMNEQ macros 2024-07-12 10:12:11 -06:00
kvm
linux file: add fput() cleanup helper 2024-08-09 12:44:50 +02:00
math-emu
media
memory
misc
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-07-15 13:19:17 -07:00
pcmcia
ras
rdma
rv
scsi for-6.11/block-20240710 2024-07-15 14:20:22 -07:00
soc net: Add struct kernel_ethtool_ts_info 2024-07-15 08:02:26 -07:00
sound
target
trace NFS Client Updates for Linux 6.11 2024-07-18 17:17:30 -07:00
uapi nsfs: iterate through mount namespaces 2024-08-09 12:46:59 +02:00
ufs
vdso
video
xen x86/xen: eliminate some private header files 2024-07-11 16:33:48 +02:00