mirror-linux/tools/testing/selftests
Linus Torvalds 7c8a4671dc vfs-7.1-rc1.mount.v2
Please consider pulling these changes from the signed vfs-7.1-rc1.mount.v2 tag.
 
 Thanks!
 Christian
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRAhzRXHqcMeLMyaSiRxhvAZXjcogUCad3vFgAKCRCRxhvAZXjc
 onXwAQDwEGvpMUUiuI/JWFqCA5vY5LXXr/36wdcs0iUL1uy9IgEAyOdnYhYkcaX1
 3lm87f6OmYkhlq6enJbco7uT4CUzlQA=
 =1Ls8
 -----END PGP SIGNATURE-----

Merge tag 'vfs-7.1-rc1.mount.v2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs mount updates from Christian Brauner:

 - Add FSMOUNT_NAMESPACE flag to fsmount() that creates a new mount
   namespace with the newly created filesystem attached to a copy of the
   real rootfs. This returns a namespace file descriptor instead of an
   O_PATH mount fd, similar to how OPEN_TREE_NAMESPACE works for
   open_tree().

   This allows creating a new filesystem and immediately placing it in a
   new mount namespace in a single operation, which is useful for
   container runtimes and other namespace-based isolation mechanisms.

   This accompanies OPEN_TREE_NAMESPACE and avoids a needless detour via
   OPEN_TREE_NAMESPACE to get the same effect. Will be especially useful
   when you mount an actual filesystem to be used as the container
   rootfs.

 - Currently, creating a new mount namespace always copies the entire
   mount tree from the caller's namespace. For containers and sandboxes
   that intend to build their mount table from scratch this is wasteful:
   they inherit a potentially large mount tree only to immediately tear
   it down.

   This series adds support for creating a mount namespace that contains
   only a clone of the root mount, with none of the child mounts. Two
   new flags are introduced:

     - CLONE_EMPTY_MNTNS (0x400000000) for clone3(), using the 64-bit flag space
     - UNSHARE_EMPTY_MNTNS (0x00100000) for unshare()

   Both flags imply CLONE_NEWNS. The resulting namespace contains a
   single nullfs root mount with an immutable empty directory. The
   intended workflow is to then mount a real filesystem (e.g., tmpfs)
   over the root and build the mount table from there.

 - Allow MOVE_MOUNT_BENEATH to target the caller's rootfs, allowing to
   switch out the rootfs without pivot_root(2).

   The traditional approach to switching the rootfs involves
   pivot_root(2) or a chroot_fs_refs()-based mechanism that atomically
   updates fs->root for all tasks sharing the same fs_struct. This has
   consequences for fork(), unshare(CLONE_FS), and setns().

   This series instead decomposes root-switching into individually
   atomic, locally-scoped steps:

	fd_tree = open_tree(-EBADF, "/newroot", OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC);
	fchdir(fd_tree);
	move_mount(fd_tree, "", AT_FDCWD, "/", MOVE_MOUNT_BENEATH | MOVE_MOUNT_F_EMPTY_PATH);
	chroot(".");
	umount2(".", MNT_DETACH);

   Since each step only modifies the caller's own state, the
   fork/unshare/setns races are eliminated by design.

   A key step to making this possible is to remove the locked mount
   restriction. Originally MOVE_MOUNT_BENEATH doesn't support mounting
   beneath a mount that is locked. The locked mount protects the
   underlying mount from being revealed. This is a core mechanism of
   unshare(CLONE_NEWUSER | CLONE_NEWNS). The mounts in the new mount
   namespace become locked. That effectively makes the new mount table
   useless as the caller cannot ever get rid of any of the mounts no
   matter how useless they are.

   We can lift this restriction though. We simply transfer the locked
   property from the top mount to the mount beneath. This works because
   what we care about is to protect the underlying mount aka the parent.
   The mount mounted between the parent and the top mount takes over the
   job of protecting the parent mount from the top mount mount. This
   leaves us free to remove the locked property from the top mount which
   can consequently be unmounted:

	unshare(CLONE_NEWUSER | CLONE_NEWNS)

   and we inherit a clone of procfs on /proc then currently we cannot
   unmount it as:

	umount -l /proc

   will fail with EINVAL because the procfs mount is locked.

   After this series we can now do:

	mount --beneath -t tmpfs tmpfs /proc
	umount -l /proc

   after which a tmpfs mount has been placed beneath the procfs mount.
   The tmpfs mount has become locked and the procfs mount has become
   unlocked.

   This means you can safely modify an inherited mount table after
   unprivileged namespace creation.

   Afterwards we simply make it possible to move a mount beneath the
   rootfs allowing to upgrade the rootfs.

   Removing the locked restriction makes this very useful for containers
   created with unshare(CLONE_NEWUSER | CLONE_NEWNS) to reshuffle an
   inherited mount table safely and MOVE_MOUNT_BENEATH makes it possible
   to switch out the rootfs instead of using the costly pivot_root(2).

* tag 'vfs-7.1-rc1.mount.v2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  selftests/namespaces: remove unused utils.h include from listns_efault_test
  selftests/fsmount_ns: add missing TARGETS and fix cap test
  selftests/empty_mntns: fix wrong CLONE_EMPTY_MNTNS hex value in comment
  selftests/empty_mntns: fix statmount_alloc() signature mismatch
  selftests/statmount: remove duplicate wait_for_pid()
  mount: always duplicate mount
  selftests/filesystems: add MOVE_MOUNT_BENEATH rootfs tests
  move_mount: allow MOVE_MOUNT_BENEATH on the rootfs
  move_mount: transfer MNT_LOCKED
  selftests/filesystems: add clone3 tests for empty mount namespaces
  selftests/filesystems: add tests for empty mount namespaces
  namespace: allow creating empty mount namespaces
  selftests: add FSMOUNT_NAMESPACE tests
  selftests/statmount: add statmount_alloc() helper
  tools: update mount.h header
  mount: add FSMOUNT_NAMESPACE
  mount: simplify __do_loopback()
  mount: start iterating from start of rbtree
2026-04-14 19:59:25 -07:00
..
acct selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
alsa selftests: ALSA: Remove unused variable in utimer-test 2026-01-19 09:12:59 +01:00
amd-pstate
arm64 selftests/arm64: Implement cmpbr_sigill() to hwcap test 2026-03-14 16:58:16 +00:00
bpf Networking changes for 7.1. 2026-04-14 18:36:10 -07:00
breakpoints selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
cachestat selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
capabilities selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
cgroup Driver core changes for 7.1-rc1 2026-04-13 19:03:11 -07:00
clone3 selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
connector selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
core selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
coredump selftests: check pidfd_info->coredump_code correctness 2026-03-23 16:29:15 +01:00
cpu-hotplug selftests/cpu-hotplug: Fix check for cpu hotplug not supported 2026-03-31 16:07:19 -06:00
cpufreq
damon selftests/damon/wss_estimation: deduplicate failed samples output 2026-01-31 14:22:45 -08:00
devices
dm-verity selftests: add dm-verity keyring selftests 2026-01-19 15:21:26 +01:00
dmabuf-heaps selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
drivers Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-04-14 12:04:00 -07:00
dt
efivarfs
exec selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
fchmodat2 selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
filelock selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
filesystems vfs-7.1-rc1.mount.v2 2026-04-14 19:59:25 -07:00
firmware
fpu
ftrace selftests/ftrace: Quote check_requires comparisons 2026-04-13 11:05:39 -06:00
futex Futex changes for v6.19: 2025-12-10 17:21:30 +09:00
gpio selftests: gpio: Add gpio-cdev-uaf tests 2026-02-27 10:05:22 +01:00
hid selftests/hid: fix compilation when bpf_wq and hid_device are not exported 2026-03-16 16:21:06 +01:00
ia64
intel_pstate selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
iommu iommufd/selftest: Make it clearer to gcc that the access is not out of bounds 2025-12-15 20:34:41 -04:00
ipc selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
ir selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
kcmp selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
kexec selftests/kexec: Ignore selftest binary 2025-09-25 13:43:28 -06:00
kho kho: make debugfs interface optional 2025-11-27 14:24:31 -08:00
kmod
kselftest selftests/run_kselftest.sh: Allow choosing per-test log directory 2026-04-13 11:05:39 -06:00
kselftest_harness selftests: harness: Validate intermixing of kselftest and harness functionality 2026-03-31 13:48:34 -06:00
kvm arm64 updates for 7.1: 2026-04-14 16:48:56 -07:00
landlock selftests/landlock: Simplify ruleset creation and enforcement in fs_test 2026-04-07 18:51:10 +02:00
lib
livepatch selftests: livepatch: use canonical ftrace path 2025-10-15 14:50:46 +02:00
liveupdate selftests/liveupdate: add kexec test for multiple and empty sessions 2025-11-27 14:24:42 -08:00
lkdtm lkdtm/fortify: Drop unneeded FORTIFY_STR_OBJECT test 2026-03-31 16:53:47 -07:00
locking
lsm selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
media_tests selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
membarrier selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
memfd selftests/memfd: use IPC semaphore instead of SIGSTOP/SIGCONT 2026-02-12 15:45:57 -08:00
memory-hotplug
mincore selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
mm mm.git review status for linus..mm-stable 2026-02-18 20:50:32 -08:00
module
mount
mount_setattr selftests/mount_setattr: increase tmpfs size for idmapped mount tests 2026-03-17 16:59:45 +01:00
move_mount_set_group selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
mqueue selftests/mqueue: Fix incorrectly named file 2026-03-31 15:01:51 -06:00
mseal_system_mappings selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
namespaces selftests/namespaces: remove unused utils.h include from listns_efault_test 2026-04-14 09:31:18 +02:00
nci selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
net selftests/net: Add additional test coverage in nk_qlease 2026-04-14 08:17:02 -07:00
nolibc selftests/nolibc: use gcc 15 2026-04-09 23:25:45 +02:00
ntb
openat2 selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
pci_endpoint selftests: pci_endpoint: Add BAR subrange mapping test case 2026-01-29 17:42:37 -06:00
pcie_bwctrl
perf_events selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
pid_namespace selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
pidfd selftests: check pidfd_info->coredump_code correctness 2026-03-23 16:29:15 +01:00
power_supply
powerpc selftests/powerpc: Suppress -Wmaybe-uninitialized with GCC 15 2026-04-01 09:21:04 +05:30
prctl selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
proc selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
pstore
ptp selftests: ptp: treat unsupported PHC operations as skip 2026-01-27 17:57:28 -08:00
ptrace selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
rcutorture rcutorture: Add NOCB02 config for nocb poll mode testing 2026-03-30 15:48:14 -04:00
resctrl selftests/resctrl: Fix non-contiguous CBM check for Hygon 2026-01-09 16:49:01 -07:00
ring-buffer selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
riscv prctl: cfi: change the branch landing pad prctl()s to be more descriptive 2026-04-04 18:40:58 -06:00
rlimits
rseq selftests/rseq: Add rseq slice histogram script 2026-01-22 11:11:20 +01:00
rtc selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
rust
safesetid
sched
sched_ext selftests/sched_ext: Add cyclic SCX_KICK_WAIT stress test 2026-03-30 08:37:55 -10:00
seccomp selftests/seccomp: Add hard-coded __NR_uprobe for x86_64 2026-04-03 08:41:38 -07:00
sgx selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
signal selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
size
sparc64 selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
splice
static_keys
sync selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
syscall_user_dispatch selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
sysctl
tc-testing Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-04-02 11:03:13 -07:00
tdx selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
thermal/intel thermal: intel: selftests: workload_hint: Support slow workload hints 2026-01-07 21:42:10 +01:00
timens selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
timers Significant patch series in this pull request: 2025-12-06 14:01:20 -08:00
tmpfs selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
tpm2 selftests: tpm2: Fix ill defined assertions 2025-12-03 22:55:27 +02:00
tty TTY/Serial changes for 6.19-rc1 2025-12-06 18:38:19 -08:00
turbostat
ublk selftests/ublk: add read-only buffer registration test 2026-04-07 07:42:39 -06:00
uevent selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
user_events selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
vDSO selftests: vDSO: vdso_test_correctness: Add a test for time() 2026-03-11 15:23:24 +01:00
verification selftests/verification: Add initial RV tests 2025-11-11 13:18:55 +01:00
vfio vfio: selftests: only build tests on arm64 and x86_64 2026-02-06 15:08:05 -07:00
vsock selftests/vsock: fix vsock_test path shadowing in nested VMs 2026-03-20 18:34:48 -07:00
watchdog
wireguard watchdog: softlockup: panic when lockup duration exceeds N thresholds 2026-01-20 19:44:20 -08:00
x86 selftests/x86: Clean up sysret_rip coding style 2026-01-19 12:06:11 +01:00
zram mm: remove unused zpool layer 2025-09-21 14:21:59 -07:00
.gitignore
Makefile vfs-7.1-rc1.mount.v2 2026-04-14 19:59:25 -07:00
gen_kselftest_tar.sh
kselftest.h selftests: kselftest: Add ksft_reset_state() 2026-03-31 13:48:23 -06:00
kselftest_deps.sh
kselftest_harness.h linux_kselftest-next-7.1-rc1 2026-04-14 17:46:12 -07:00
kselftest_install.sh
kselftest_module.h
lib.mk selftests: complete kselftest include centralization 2025-11-27 14:24:31 -08:00
run_kselftest.sh selftests/run_kselftest.sh: Allow choosing per-test log directory 2026-04-13 11:05:39 -06:00