[Devel] [PATCH RHEL7 COMMIT] ms/fs: Add a missing permission check to do_umount

Konstantin Khorenko khorenko at virtuozzo.com
Tue Mar 15 09:04:12 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.1
------>
commit 569b07f3ea0a2e06f5f3f043d2b757f226edf703
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Tue Mar 15 20:04:12 2016 +0400

    ms/fs: Add a missing permission check to do_umount
    
    ms commit a1480dcc3c70 ("fs: Add a missing permission check to do_umount")
    
    Accessing do_remount_sb should require global CAP_SYS_ADMIN, but
    only one of the two call sites was appropriately protected.
    
    Fixes CVE-2014-7975.
    
    Signed-off-by: Andy Lutomirski <luto at amacapital.net>
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    
    Found during investigation of
    https://jira.sw.ru/browse/PSBM-43294
---
 fs/namespace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/namespace.c b/fs/namespace.c
index dba0c40..c4e4336 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1287,6 +1287,8 @@ static int do_umount(struct mount *mnt, int flags)
 		 * Special case for "unmounting" root ...
 		 * we just try to remount it readonly.
 		 */
+		if (!ve_capable(CAP_SYS_ADMIN))
+			return -EPERM;
 		down_write(&sb->s_umount);
 		if (!(sb->s_flags & MS_RDONLY))
 			retval = do_remount_sb(sb, MS_RDONLY, NULL, 0);


More information about the Devel mailing list