Skip to contentSkip to conversation

umount: Allow superblock owners to force umount

PATCH In review Sasha Levin 3 participants 3 messages Mar 31, 2025 – Apr 20, 2025

Subsystems (2)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

PATCH 1/1 umount: Allow superblock owners to force umount

From: Trond Myklebust <[email protected]>

[ Upstream commit e1ff7aa34dec7e650159fd7ca8ec6af7cc428d9f ]

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.

---
 fs/namespace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/namespace.c +2 -1
index 7e67db7456b3d..2f97112657adc 100644
@@ -1716,6 +1716,7 @@ static inline bool may_mandlock(void)
 static int can_umount(const struct path *path, int flags)
 {
 	struct mount *mnt = real_mount(path->mnt);
+	struct super_block *sb = path->dentry->d_sb;
 
 	if (!may_mount())
 		return -EPERM;
@@ -1725,7 +1726,7 @@ static int can_umount(const struct path *path, int flags)
 		return -EINVAL;
 	if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */
 		return -EINVAL;
-	if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))
+	if (flags & MNT_FORCE && !ns_capable(sb->s_user_ns, CAP_SYS_ADMIN))
 		return -EPERM;
 	return 0;
 }
Signature · 1 line
2.39.5
#1 lore raw

Hi!

Quoted 7 lines

From: Trond Myklebust <[email protected]>

[ Upstream commit e1ff7aa34dec7e650159fd7ca8ec6af7cc428d9f ]

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.

Should we be tweaking permissions in -stable?

Best regards,
Pavel

Signature · 2 lines
I don't work for Nazis and criminals, and neither should you.
Boycott Putin, Trump, and Musk!
#2 lore raw
Quoted 11 lines · Pavel Machek

Hi!

Quoted 7 lines

From: Trond Myklebust <[email protected]>

[ Upstream commit e1ff7aa34dec7e650159fd7ca8ec6af7cc428d9f ]

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.

Should we be tweaking permissions in -stable?

Seems fine to me if you'd backport it.