|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6 |
|
| #
d1ddc6f1 |
| 08-May-2025 |
Al Viro <[email protected]> |
fix IS_MNT_PROPAGATING uses
propagate_mnt() does not attach anything to mounts created during propagate_mnt() itself. What's more, anything on ->mnt_slave_list of such new mount must also be new, s
fix IS_MNT_PROPAGATING uses
propagate_mnt() does not attach anything to mounts created during propagate_mnt() itself. What's more, anything on ->mnt_slave_list of such new mount must also be new, so we don't need to even look there.
When move_mount() had been introduced, we've got an additional class of mounts to skip - if we are moving from anon namespace, we do not want to propagate to mounts we are moving (i.e. all mounts in that anon namespace).
Unfortunately, the part about "everything on their ->mnt_slave_list will also be ignorable" is not true - if we have propagation graph A -> B -> C and do OPEN_TREE_CLONE open_tree() of B, we get A -> [B <-> B'] -> C as propagation graph, where B' is a clone of B in our detached tree. Making B private will result in A -> B' -> C C still gets propagation from A, as it would after making B private if we hadn't done that open_tree(), but now the propagation goes through B'. Trying to move_mount() our detached tree on subdirectory in A should have * moved B' on that subdirectory in A * skipped the corresponding subdirectory in B' itself * copied B' on the corresponding subdirectory in C. As it is, the logics in propagation_next() and friends ends up skipping propagation into C, since it doesn't consider anything downstream of B'.
IOW, walking the propagation graph should only skip the ->mnt_slave_list of new mounts; the only places where the check for "in that one anon namespace" are applicable are propagate_one() (where we should treat that as the same kind of thing as "mountpoint we are looking at is not visible in the mount we are looking at") and propagation_would_overmount(). The latter is better dealt with in the caller (can_move_mount_beneath()); on the first call of propagation_would_overmount() the test is always false, on the second it is always true in "move from anon namespace" case and always false in "move within our namespace" one, so it's easier to just use check_mnt() before bothering with the second call and be done with that.
Fixes: 064fe6e233e8 ("mount: handle mount propagation for detached mount trees") Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
show more ...
|
|
Revision tags: v6.15-rc5 |
|
| #
267fc3a0 |
| 29-Apr-2025 |
Al Viro <[email protected]> |
do_move_mount(): don't leak MNTNS_PROPAGATING on failures
as it is, a failed move_mount(2) from anon namespace breaks all further propagation into that namespace, including normal mounts in non-anon
do_move_mount(): don't leak MNTNS_PROPAGATING on failures
as it is, a failed move_mount(2) from anon namespace breaks all further propagation into that namespace, including normal mounts in non-anon namespaces that would otherwise propagate there.
Fixes: 064fe6e233e8 ("mount: handle mount propagation for detached mount trees") Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
show more ...
|
| #
65781e19 |
| 29-Apr-2025 |
Al Viro <[email protected]> |
do_umount(): add missing barrier before refcount checks in sync case
do_umount() analogue of the race fixed in 119e1ef80ecf "fix __legitimize_mnt()/mntput() race". Here we want to make sure that if
do_umount(): add missing barrier before refcount checks in sync case
do_umount() analogue of the race fixed in 119e1ef80ecf "fix __legitimize_mnt()/mntput() race". Here we want to make sure that if __legitimize_mnt() doesn't notice our lock_mount_hash(), we will notice their refcount increment. Harder to hit than mntput_no_expire() one, fortunately, and consequences are milder (sync umount acting like umount -l on a rare race with RCU pathwalk hitting at just the wrong time instead of use-after-free galore mntput_no_expire() counterpart used to be hit). Still a bug...
Fixes: 48a066e72d97 ("RCU'd vfsmounts") Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
show more ...
|
|
Revision tags: v6.15-rc4 |
|
| #
250cf369 |
| 27-Apr-2025 |
Al Viro <[email protected]> |
__legitimize_mnt(): check for MNT_SYNC_UMOUNT should be under mount_lock
... or we risk stealing final mntput from sync umount - raising mnt_count after umount(2) has verified that victim is not bus
__legitimize_mnt(): check for MNT_SYNC_UMOUNT should be under mount_lock
... or we risk stealing final mntput from sync umount - raising mnt_count after umount(2) has verified that victim is not busy, but before it has set MNT_SYNC_UMOUNT; in that case __legitimize_mnt() doesn't see that it's safe to quietly undo mnt_count increment and leaves dropping the reference to caller, where it'll be a full-blown mntput().
Check under mount_lock is needed; leaving the current one done before taking that makes no sense - it's nowhere near common enough to bother with.
Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
show more ...
|
| #
0d039eac |
| 23-Apr-2025 |
Al Viro <[email protected]> |
fix a couple of races in MNT_TREE_BENEATH handling by do_move_mount()
Normally do_lock_mount(path, _) is locking a mountpoint pinned by *path and at the time when matching unlock_mount() unlocks tha
fix a couple of races in MNT_TREE_BENEATH handling by do_move_mount()
Normally do_lock_mount(path, _) is locking a mountpoint pinned by *path and at the time when matching unlock_mount() unlocks that location it is still pinned by the same thing.
Unfortunately, for 'beneath' case it's no longer that simple - the object being locked is not the one *path points to. It's the mountpoint of path->mnt. The thing is, without sufficient locking ->mnt_parent may change under us and none of the locks are held at that point. The rules are * mount_lock stabilizes m->mnt_parent for any mount m. * namespace_sem stabilizes m->mnt_parent, provided that m is mounted. * if either of the above holds and refcount of m is positive, we are guaranteed the same for refcount of m->mnt_parent.
namespace_sem nests inside inode_lock(), so do_lock_mount() has to take inode_lock() before grabbing namespace_sem. It does recheck that path->mnt is still mounted in the same place after getting namespace_sem, and it does take care to pin the dentry. It is needed, since otherwise we might end up with racing mount --move (or umount) happening while we were getting locks; in that case dentry would no longer be a mountpoint and could've been evicted on memory pressure along with its inode - not something you want when grabbing lock on that inode.
However, pinning a dentry is not enough - the matching mount is also pinned only by the fact that path->mnt is mounted on top it and at that point we are not holding any locks whatsoever, so the same kind of races could end up with all references to that mount gone just as we are about to enter inode_lock(). If that happens, we are left with filesystem being shut down while we are holding a dentry reference on it; results are not pretty.
What we need to do is grab both dentry and mount at the same time; that makes inode_lock() safe *and* avoids the problem with fs getting shut down under us. After taking namespace_sem we verify that path->mnt is still mounted (which stabilizes its ->mnt_parent) and check that it's still mounted at the same place. From that point on to the matching namespace_unlock() we are guaranteed that mount/dentry pair we'd grabbed are also pinned by being the mountpoint of path->mnt, so we can quietly drop both the dentry reference (as the current code does) and mnt one - it's OK to do under namespace_sem, since we are not dropping the final refs.
That solves the problem on do_lock_mount() side; unlock_mount() also has one, since dentry is guaranteed to stay pinned only until the namespace_unlock(). That's easy to fix - just have inode_unlock() done earlier, while it's still pinned by mp->m_dentry.
Fixes: 6ac392815628 "fs: allow to mount beneath top mount" # v6.5+ Signed-off-by: Al Viro <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
|
Revision tags: v6.15-rc3, v6.15-rc2 |
|
| #
47a742fd |
| 10-Apr-2025 |
Jan Stancek <[email protected]> |
fs: use namespace_{lock,unlock} in dissolve_on_fput()
In commit b73ec10a4587 ("fs: add fastpath for dissolve_on_fput()"), the namespace_{lock,unlock} has been replaced with scoped_guard using the na
fs: use namespace_{lock,unlock} in dissolve_on_fput()
In commit b73ec10a4587 ("fs: add fastpath for dissolve_on_fput()"), the namespace_{lock,unlock} has been replaced with scoped_guard using the namespace_sem. This however now also skips processing of 'unmounted' list in namespace_unlock(), and mount is not (immediately) cleaned up.
For example, this causes LTP move_mount02 fail: ... move_mount02.c:80: TPASS: invalid-from-fd: move_mount() failed as expected: EBADF (9) move_mount02.c:80: TPASS: invalid-from-path: move_mount() failed as expected: ENOENT (2) move_mount02.c:80: TPASS: invalid-to-fd: move_mount() failed as expected: EBADF (9) move_mount02.c:80: TPASS: invalid-to-path: move_mount() failed as expected: ENOENT (2) move_mount02.c:80: TPASS: invalid-flags: move_mount() failed as expected: EINVAL (22) tst_test.c:1833: TINFO: === Testing on ext3 === tst_test.c:1170: TINFO: Formatting /dev/loop0 with ext3 opts='' extra opts='' mke2fs 1.47.2 (1-Jan-2025) /dev/loop0 is apparently in use by the system; will not make a filesystem here! tst_test.c:1170: TBROK: mkfs.ext3 failed with exit code 1
The test makes number of move_mount() calls but these are all designed to fail with specific errno. Even after test, 'losetup -d' can't detach loop device.
Define a new guard for dissolve_on_fput, that will use namespace_{lock,unlock}.
Fixes: b73ec10a4587 ("fs: add fastpath for dissolve_on_fput()") Signed-off-by: Jan Stancek <[email protected]> Link: https://lore.kernel.org/cad2f042b886bf0ced3d8e3aff120ec5e0125d61.1744297468.git.jstancek@redhat.com Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
d43dbf73 |
| 09-Apr-2025 |
Christian Brauner <[email protected]> |
mount: ensure we don't pointlessly walk the mount tree
This logic got broken recently. Add it back.
Fixes: 474f7825d533 ("fs: add copy_mount_setattr() helper") Link: https://lore.kernel.org/2025040
mount: ensure we don't pointlessly walk the mount tree
This logic got broken recently. Add it back.
Fixes: 474f7825d533 ("fs: add copy_mount_setattr() helper") Link: https://lore.kernel.org/20250409-sektflaschen-gecko-27c021fbd222@brauner Tested-by: Mikhail Gavrilov <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
|
Revision tags: v6.15-rc1 |
|
| #
c0dbd11a |
| 03-Apr-2025 |
Christian Brauner <[email protected]> |
fs: actually hold the namespace semaphore
Don't use a scoped guard that only protects the next statement.
Use a regular guard to make sure that the namespace semaphore is held across the whole func
fs: actually hold the namespace semaphore
Don't use a scoped guard that only protects the next statement.
Use a regular guard to make sure that the namespace semaphore is held across the whole function.
Signed-off-by: Christian Brauner <[email protected]> Reported-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/all/20250401170715.GA112019@unreal/ Fixes: db04662e2f4f ("fs: allow detached mounts in clone_private_mount()") Signed-off-by: Linus Torvalds <[email protected]>
show more ...
|
| #
9e6901f1 |
| 27-Mar-2025 |
Gustavo A. R. Silva <[email protected]> |
fs: namespace: Avoid -Wflex-array-member-not-at-end warning
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Move the conflicting declaratio
fs: namespace: Avoid -Wflex-array-member-not-at-end warning
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Move the conflicting declaration to the end of the structure. Notice that `struct statmount` is a flexible structure --a structure that contains a flexible-array member.
Fix the following warning:
fs/namespace.c:5329:26: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
Signed-off-by: "Gustavo A. R. Silva" <[email protected]> Link: https://lore.kernel.org/r/Z-SZKNdCiAkVJvqm@kspp Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
|
Revision tags: v6.14 |
|
| #
e1ff7aa3 |
| 18-Mar-2025 |
Trond Myklebust <[email protected]> |
umount: Allow superblock owners to force umount
Loosen the permission check on forced umount to allow users holding CAP_SYS_ADMIN privileges in namespaces that are privileged with respect to the use
umount: Allow superblock owners to force umount
Loosen the permission check on forced umount to allow users holding CAP_SYS_ADMIN privileges in namespaces that are privileged with respect to the userns that originally mounted the filesystem.
Signed-off-by: Trond Myklebust <[email protected]> Link: https://lore.kernel.org/r/12f212d4ef983714d065a6bb372fbb378753bf4c.1742315194.git.trond.myklebust@hammerspace.com Acked-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc7, v6.14-rc6, v6.14-rc5 |
|
| #
99b6a1de |
| 26-Feb-2025 |
Arnd Bergmann <[email protected]> |
fs: namespace: fix uninitialized variable use
clang correctly notices that the 'uflags' variable initialization only happens in some cases:
fs/namespace.c:4622:6: error: variable 'uflags' is used u
fs: namespace: fix uninitialized variable use
clang correctly notices that the 'uflags' variable initialization only happens in some cases:
fs/namespace.c:4622:6: error: variable 'uflags' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] 4622 | if (flags & MOVE_MOUNT_F_EMPTY_PATH) uflags = AT_EMPTY_PATH; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/namespace.c:4623:48: note: uninitialized use occurs here 4623 | from_name = getname_maybe_null(from_pathname, uflags); | ^~~~~~ fs/namespace.c:4622:2: note: remove the 'if' if its condition is always true 4622 | if (flags & MOVE_MOUNT_F_EMPTY_PATH) uflags = AT_EMPTY_PATH; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes: b1e9423d65e3 ("fs: support getname_maybe_null() in move_mount()") Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
064fe6e2 |
| 25-Feb-2025 |
Christian Brauner <[email protected]> |
mount: handle mount propagation for detached mount trees
In commit ee2e3f50629f ("mount: fix mounting of detached mounts onto targets that reside on shared mounts") I fixed a bug where propagating t
mount: handle mount propagation for detached mount trees
In commit ee2e3f50629f ("mount: fix mounting of detached mounts onto targets that reside on shared mounts") I fixed a bug where propagating the source mount tree of an anonymous mount namespace into a target mount tree of a non-anonymous mount namespace could be used to trigger an integer overflow in the non-anonymous mount namespace causing any new mounts to fail.
The cause of this was that the propagation algorithm was unable to recognize mounts from the source mount tree that were already propagated into the target mount tree and then reappeared as propagation targets when walking the destination propagation mount tree.
When fixing this I disabled mount propagation into anonymous mount namespaces. Make it possible for anonymous mount namespace to receive mount propagation events correctly. This is no also a correctness issue now that we allow mounting detached mount trees onto detached mount trees.
Mark the source anonymous mount namespace with MNTNS_PROPAGATING indicating that all mounts belonging to this mount namespace are currently in the process of being propagated and make the propagation algorithm discard those if they appear as propagation targets.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
f8b6cd66 |
| 25-Feb-2025 |
Christian Brauner <[email protected]> |
fs: allow creating detached mounts from fsmount() file descriptors
The previous patch series only enabled the creation of detached mounts from detached mounts that were created via open_tree(). In s
fs: allow creating detached mounts from fsmount() file descriptors
The previous patch series only enabled the creation of detached mounts from detached mounts that were created via open_tree(). In such cases we know that the origin sequence number for the newly created anonymous mount namespace will be set to the sequence number of the mount namespace the source mount belonged to.
But fsmount() creates an anonymous mount namespace that does not have an origin mount namespace as the anonymous mount namespace was derived from a filesystem context created via fsopen().
Account for this case and allow the creation of detached mounts from mounts created via fsmount(). Consequently, any such detached mount created from an fsmount() mount will also have a zero origin sequence number.
This allows to mount subdirectories without ever having to expose the filesystem to a a non-anonymous mount namespace:
fd_context = sys_fsopen("tmpfs", 0); sys_fsconfig(fd_context, FSCONFIG_CMD_CREATE, NULL, NULL, 0); fd_tmpfs = sys_fsmount(fd_context, 0, 0); mkdirat(fd_tmpfs, "subdir", 0755); fd_tree = sys_open_tree(fd_tmpfs, "subdir", OPEN_TREE_CLONE); sys_move_mount(fd_tree, "", -EBADF, "/mnt", MOVE_MOUNT_F_EMPTY_PATH);
Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc4 |
|
| #
21107723 |
| 21-Feb-2025 |
Christian Brauner <[email protected]> |
fs: mount detached mounts onto detached mounts
Currently, detached mounts can only be mounted onto attached mounts. This limitation makes it impossible to assemble a new private rootfs and move it i
fs: mount detached mounts onto detached mounts
Currently, detached mounts can only be mounted onto attached mounts. This limitation makes it impossible to assemble a new private rootfs and move it into place. That's an extremely powerful concept for container and service workloads that we should support.
Right now, a detached tree must be created, attached, then it can gain additional mounts and then it can either be moved (if it doesn't reside under a shared mount) or a detached mount created again. Lift this restriction.
In order to allow mounting detached mounts onto other detached mounts the same permission model used for creating detached mounts from detached mounts can be used:
(1) Check that the caller is privileged over the owning user namespace of it's current mount namespace.
(2) Check that the caller is located in the mount namespace of the mount it wants to create a detached copy of.
The origin mount namespace of the anonymous mount namespace must be the same as the caller's mount namespace. To establish this the sequence number of the caller's mount namespace and the origin sequence number of the anonymous mount namespace are compared.
The caller is always located in a non-anonymous mount namespace since anonymous mount namespaces cannot be setns()ed into. The caller's mount namespace will thus always have a valid sequence number.
The owning namespace of any mount namespace, anonymous or non-anonymous, can never change. A mount attached to a non-anonymous mount namespace can never change mount namespace.
If the sequence number of the non-anonymous mount namespace and the origin sequence number of the anonymous mount namespace match, the owning namespaces must match as well.
Hence, the capability check on the owning namespace of the caller's mount namespace ensures that the caller has the ability to attach the mount tree.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
f9fde814 |
| 21-Feb-2025 |
Christian Brauner <[email protected]> |
fs: support getname_maybe_null() in move_mount()
Allow move_mount() to work with NULL path arguments.
Link: https://lore.kernel.org/r/[email protected] Signed-
fs: support getname_maybe_null() in move_mount()
Allow move_mount() to work with NULL path arguments.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
c5c12f87 |
| 21-Feb-2025 |
Christian Brauner <[email protected]> |
fs: create detached mounts from detached mounts
Add the ability to create detached mounts from detached mounts.
Currently, detached mounts can only be created from attached mounts. This limitaton p
fs: create detached mounts from detached mounts
Add the ability to create detached mounts from detached mounts.
Currently, detached mounts can only be created from attached mounts. This limitaton prevents various use-cases. For example, the ability to mount a subdirectory without ever having to make the whole filesystem visible first.
The current permission model for the OPEN_TREE_CLONE flag of the open_tree() system call is:
(1) Check that the caller is privileged over the owning user namespace of it's current mount namespace.
(2) Check that the caller is located in the mount namespace of the mount it wants to create a detached copy of.
While it is not strictly necessary to do it this way it is consistently applied in the new mount api. This model will also be used when allowing the creation of detached mount from another detached mount.
The (1) requirement can simply be met by performing the same check as for the non-detached case, i.e., verify that the caller is privileged over its current mount namespace.
To meet the (2) requirement it must be possible to infer the origin mount namespace that the anonymous mount namespace of the detached mount was created from.
The origin mount namespace of an anonymous mount is the mount namespace that the mounts that were copied into the anonymous mount namespace originate from.
The origin mount namespace of the anonymous mount namespace must be the same as the caller's mount namespace. To establish this the sequence number of the caller's mount namespace and the origin sequence number of the anonymous mount namespace are compared.
The caller is always located in a non-anonymous mount namespace since anonymous mount namespaces cannot be setns()ed into. The caller's mount namespace will thus always have a valid sequence number.
The owning namespace of any mount namespace, anonymous or non-anonymous, can never change. A mount attached to a non-anonymous mount namespace can never change mount namespace.
If the sequence number of the non-anonymous mount namespace and the origin sequence number of the anonymous mount namespace match, the owning namespaces must match as well.
Hence, the capability check on the owning namespace of the caller's mount namespace ensures that the caller has the ability to copy the mount tree.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
9ed72af4 |
| 21-Feb-2025 |
Christian Brauner <[email protected]> |
fs: add may_copy_tree()
Add a helper that verifies whether a caller may copy a given mount tree.
Link: https://lore.kernel.org/r/[email protected] Signed-off-b
fs: add may_copy_tree()
Add a helper that verifies whether a caller may copy a given mount tree.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
b73ec10a |
| 21-Feb-2025 |
Christian Brauner <[email protected]> |
fs: add fastpath for dissolve_on_fput()
Instead of acquiring the namespace semaphore and the mount lock everytime we close a file with FMODE_NEED_UNMOUNT set add a fastpath that checks whether we ne
fs: add fastpath for dissolve_on_fput()
Instead of acquiring the namespace semaphore and the mount lock everytime we close a file with FMODE_NEED_UNMOUNT set add a fastpath that checks whether we need to at all. Most of the time the caller will have attached the mount to the filesystem hierarchy and there's nothing to do.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
043bc81e |
| 21-Feb-2025 |
Christian Brauner <[email protected]> |
fs: add assert for move_mount()
After we've attached a detached mount tree the anonymous mount namespace must be empty. Add an assert and make this assumption explicit.
Link: https://lore.kernel.or
fs: add assert for move_mount()
After we've attached a detached mount tree the anonymous mount namespace must be empty. Add an assert and make this assumption explicit.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
2f576220 |
| 21-Feb-2025 |
Christian Brauner <[email protected]> |
fs: add mnt_ns_empty() helper
Add a helper that checks whether a give mount namespace is empty instead of open-coding the specific data structure check. This also be will be used in follow-up patche
fs: add mnt_ns_empty() helper
Add a helper that checks whether a give mount namespace is empty instead of open-coding the specific data structure check. This also be will be used in follow-up patches.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
3b0cdba4 |
| 21-Feb-2025 |
Christian Brauner <[email protected]> |
fs: record sequence number of origin mount namespace
Store the sequence number of the mount namespace the anonymous mount namespace has been created from. This information will be used in follow-up
fs: record sequence number of origin mount namespace
Store the sequence number of the mount namespace the anonymous mount namespace has been created from. This information will be used in follow-up patches.
Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc3, v6.14-rc2, v6.14-rc1 |
|
| #
2462651f |
| 28-Jan-2025 |
Christian Brauner <[email protected]> |
fs: allow changing idmappings
This patchset makes it possible to create a new idmapped mount from an already idmapped mount and to clear idmappings.
// Create a first idmapped mount struct mount_at
fs: allow changing idmappings
This patchset makes it possible to create a new idmapped mount from an already idmapped mount and to clear idmappings.
// Create a first idmapped mount struct mount_attr attr = { .attr_set = MOUNT_ATTR_IDMAP .userns_fd = fd_userns };
fd_tree = open_tree(-EBADF, "/", OPEN_TREE_CLONE, &attr, sizeof(attr)); move_mount(fd_tree, "", -EBADF, "/mnt", MOVE_MOUNT_F_EMPTY_PATH);
// Create a second idmapped mount from the first idmapped mount attr.attr_set = MOUNT_ATTR_IDMAP; attr.userns_fd = fd_userns2; fd_tree2 = open_tree(-EBADF, "/mnt", OPEN_TREE_CLONE, &attr, sizeof(attr));
// Create a second non-idmapped mount from the first idmapped mount: memset(&attr, 0, sizeof(attr)); attr.attr_clr = MOUNT_ATTR_IDMAP; fd_tree2 = open_tree(-EBADF, "/mnt", OPEN_TREE_CLONE, &attr, sizeof(attr));
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: "Seth Forshee (DigitalOcean)" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
325cca84 |
| 28-Jan-2025 |
Christian Brauner <[email protected]> |
fs: add kflags member to struct mount_kattr
Instead of using a boolean use a flag so we can add new flags in following patches.
Link: https://lore.kernel.org/r/20250128-work-mnt_idmap-update-v2-v1-
fs: add kflags member to struct mount_kattr
Instead of using a boolean use a flag so we can add new flags in following patches.
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: "Seth Forshee (DigitalOcean)" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
c4a16820 |
| 28-Jan-2025 |
Christian Brauner <[email protected]> |
fs: add open_tree_attr()
Add open_tree_attr() which allow to atomically create a detached mount tree and set mount options on it. If OPEN_TREE_CLONE is used this will allow the creation of a detache
fs: add open_tree_attr()
Add open_tree_attr() which allow to atomically create a detached mount tree and set mount options on it. If OPEN_TREE_CLONE is used this will allow the creation of a detached mount with a new set of mount options without it ever being exposed to userspace without that set of mount options applied.
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: "Seth Forshee (DigitalOcean)" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
show more ...
|
| #
474f7825 |
| 28-Jan-2025 |
Christian Brauner <[email protected]> |
fs: add copy_mount_setattr() helper
Split out copy_mount_setattr() from mount_setattr() so we can use it in later patches.
Link: https://lore.kernel.org/r/20250128-work-mnt_idmap-update-v2-v1-2-c25
fs: add copy_mount_setattr() helper
Split out copy_mount_setattr() from mount_setattr() so we can use it in later patches.
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: "Seth Forshee (DigitalOcean)" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
show more ...
|