Skip to content

Commit 5f20ade

Browse files
ebiedermgregkh
authored andcommitted
umount: Disallow unprivileged mount force
commit b2f5d4d upstream. Forced unmount affects not just the mount namespace but the underlying superblock as well. Restrict forced unmount to the global root user for now. Otherwise it becomes possible a user in a less privileged mount namespace to force the shutdown of a superblock of a filesystem in a more privileged mount namespace, allowing a DOS attack on root. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ebdd094 commit 5f20ade

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎fs/namespace.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,9 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
14411441
goto dput_and_out;
14421442
if (mnt->mnt.mnt_flags & MNT_LOCKED)
14431443
goto dput_and_out;
1444+
retval = -EPERM;
1445+
if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))
1446+
goto dput_and_out;
14441447

14451448
retval = do_umount(mnt, flags);
14461449
dput_and_out:

0 commit comments

Comments
 (0)