Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10] umount: Allow superblock owners to force umount
@ 2025-03-31 14:32 Sasha Levin
  2025-04-18 16:51 ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2025-03-31 14:32 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Trond Myklebust, Eric W. Biederman, Christian Brauner,
	Sasha Levin, viro, linux-fsdevel

From: Trond Myklebust <trond.myklebust@hammerspace.com>

[ 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.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Link: https://lore.kernel.org/r/12f212d4ef983714d065a6bb372fbb378753bf4c.1742315194.git.trond.myklebust@hammerspace.com
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/namespace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 7e67db7456b3d..2f97112657adc 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -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;
 }
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 5.10] umount: Allow superblock owners to force umount
  2025-03-31 14:32 [PATCH AUTOSEL 5.10] umount: Allow superblock owners to force umount Sasha Levin
@ 2025-04-18 16:51 ` Pavel Machek
  2025-04-20 10:53   ` Christian Brauner
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2025-04-18 16:51 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Trond Myklebust, Eric W. Biederman,
	Christian Brauner, viro, linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

Hi!

> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> [ 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

-- 
I don't work for Nazis and criminals, and neither should you.
Boycott Putin, Trump, and Musk!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 5.10] umount: Allow superblock owners to force umount
  2025-04-18 16:51 ` Pavel Machek
@ 2025-04-20 10:53   ` Christian Brauner
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2025-04-20 10:53 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Sasha Levin, linux-kernel, stable, Trond Myklebust,
	Eric W. Biederman, viro, linux-fsdevel

On Fri, Apr 18, 2025 at 06:51:38PM +0200, Pavel Machek wrote:
> Hi!
> 
> > From: Trond Myklebust <trond.myklebust@hammerspace.com>
> > 
> > [ 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-20 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-31 14:32 [PATCH AUTOSEL 5.10] umount: Allow superblock owners to force umount Sasha Levin
2025-04-18 16:51 ` Pavel Machek
2025-04-20 10:53   ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox