[<prev] [next>] [day] [month] [year] [list]
Message-ID: <aMhFePOxxlOtQwU2@sirena.org.uk>
Date: Mon, 15 Sep 2025 17:57:28 +0100
From: Mark Brown <broonie@...nel.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Aleksa Sarai <cyphar@...har.com>, Askar Safin <safinaskar@...omail.com>,
Christian Brauner <brauner@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Next Mailing List <linux-next@...r.kernel.org>
Subject: linux-next: manual merge of the vfs tree with the vfs-next tree
Hi all,
Today's linux-next merge of the vfs tree got a conflict in:
fs/namespace.c
between commits:
1e5f0fb41fccf ("vfs: fs/namespace.c: remove ms_flags argument from do_remount")
807602d8cfc8b ("vfs: output mount_too_revealing() errors to fscontext")
96ff702edaec8 ("mnt: support ns lookup")
from the vfs-next tree and commits:
ead5706f63cd8 ("do_{loopback,change_type,remount,reconfigure_mnt}(): constify struct path argument")
5423426a79dd4 ("switch do_new_mount_fc() to fc_mount()")
9d84d519f9fe4 ("copy_mnt_ns(): use guards")
from the vfs tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --cc fs/namespace.c
index e3ac6e06be70d,aeeb33bf3e7b3..0000000000000
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@@ -90,7 -80,16 +90,15 @@@ static DECLARE_RWSEM(namespace_sem)
static HLIST_HEAD(unmounted); /* protected by namespace_sem */
static LIST_HEAD(ex_mountpoints); /* protected by namespace_sem */
static struct mnt_namespace *emptied_ns; /* protected by namespace_sem */
-static DEFINE_SEQLOCK(mnt_ns_tree_lock);
+ static inline void namespace_lock(void);
+ static void namespace_unlock(void);
+ DEFINE_LOCK_GUARD_0(namespace_excl, namespace_lock(), namespace_unlock())
+ DEFINE_LOCK_GUARD_0(namespace_shared, down_read(&namespace_sem),
+ up_read(&namespace_sem))
+
+ DEFINE_FREE(mntput, struct vfsmount *, if (!IS_ERR(_T)) mntput(_T))
+
#ifdef CONFIG_FSNOTIFY
LIST_HEAD(notify_list); /* protected by namespace_sem */
#endif
@@@ -153,10 -195,26 +161,10 @@@ static void mnt_ns_release_rcu(struct r
static void mnt_ns_tree_remove(struct mnt_namespace *ns)
{
/* remove from global mount namespace list */
- if (!is_anon_ns(ns))
- if (!list_empty(&ns->mnt_ns_list)) {
- mnt_ns_tree_write_lock();
- rb_erase(&ns->mnt_ns_tree_node, &mnt_ns_tree);
- list_bidir_del_rcu(&ns->mnt_ns_list);
- mnt_ns_tree_write_unlock();
- }
++ if (!list_empty(&ns->mnt_ns_list))
+ ns_tree_remove(ns);
- call_rcu(&ns->mnt_ns_rcu, mnt_ns_release_rcu);
-}
-
-static int mnt_ns_find(const void *key, const struct rb_node *node)
-{
- const u64 mnt_ns_id = *(u64 *)key;
- const struct mnt_namespace *ns = node_to_mnt_ns(node);
-
- if (mnt_ns_id < ns->seq)
- return -1;
- if (mnt_ns_id > ns->seq)
- return 1;
- return 0;
+ call_rcu(&ns->ns.ns_rcu, mnt_ns_release_rcu);
}
/*
@@@ -3229,7 -3310,7 +3250,7 @@@ static int do_reconfigure_mnt(const str
* If you've mounted a non-root directory somewhere and want to do remount
* on it - tough luck.
*/
- static int do_remount(struct path *path, int sb_flags,
-static int do_remount(const struct path *path, int ms_flags, int sb_flags,
++static int do_remount(const struct path *path, int sb_flags,
int mnt_flags, void *data)
{
int err;
@@@ -3669,30 -3720,20 +3660,22 @@@ static int do_new_mount_fc(struct fs_co
if (IS_ERR(mnt))
return PTR_ERR(mnt);
+ sb = fc->root->d_sb;
+ error = security_sb_kern_mount(sb);
+ if (unlikely(error))
+ return error;
+
- if (unlikely(mount_too_revealing(sb, &mnt_flags)))
++ if (unlikely(mount_too_revealing(sb, &mnt_flags))) {
++ errorfcp(fc, "VFS", "Mount too revealing");
+ return -EPERM;
++ }
+
mnt_warn_timestamp_expiry(mountpoint, mnt);
- error = lock_mount(mountpoint, &mp);
- if (!error) {
- error = do_add_mount(real_mount(mnt), mp.mp,
- mountpoint, mnt_flags);
- unlock_mount(&mp);
- }
- if (error < 0)
- mntput(mnt);
+ LOCK_MOUNT(mp, mountpoint);
+ error = do_add_mount(real_mount(mnt), &mp, mnt_flags);
+ if (!error)
+ retain_and_null_ptr(mnt); // consumed on success
return error;
}
@@@ -4202,14 -4247,7 +4175,7 @@@ struct mnt_namespace *copy_mnt_ns(unsig
while (p->mnt.mnt_root != q->mnt.mnt_root)
p = next_mnt(skip_mnt_tree(p), old);
}
- namespace_unlock();
-
- if (rootmnt)
- mntput(rootmnt);
- if (pwdmnt)
- mntput(pwdmnt);
-
- mnt_ns_tree_add(new_ns);
+ ns_tree_add_raw(new_ns);
return new_ns;
}
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists