This is a note to let you know that I've just added the patch titled

    mnt: Implicitly add MNT_NODEV on remount when it was implicitly added by 
mount

to the 3.18-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     
mnt-implicitly-add-mnt_nodev-on-remount-when-it-was-implicitly-added-by-mount.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 3e1866410f11356a9fd869beb3e95983dc79c067 Mon Sep 17 00:00:00 2001
From: "Eric W. Biederman" <[email protected]>
Date: Wed, 13 Aug 2014 01:33:38 -0700
Subject: mnt: Implicitly add MNT_NODEV on remount when it was implicitly added 
by mount

From: "Eric W. Biederman" <[email protected]>

commit 3e1866410f11356a9fd869beb3e95983dc79c067 upstream.

Now that remount is properly enforcing the rule that you can't remove
nodev at least sandstorm.io is breaking when performing a remount.

It turns out that there is an easy intuitive solution implicitly
add nodev on remount when nodev was implicitly added on mount.

Tested-by: Cedric Bosdonnat <[email protected]>
Tested-by: Richard Weinberger <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 fs/namespace.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2100,7 +2100,13 @@ static int do_remount(struct path *path,
        }
        if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) &&
            !(mnt_flags & MNT_NODEV)) {
-               return -EPERM;
+               /* Was the nodev implicitly added in mount? */
+               if ((mnt->mnt_ns->user_ns != &init_user_ns) &&
+                   !(sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) {
+                       mnt_flags |= MNT_NODEV;
+               } else {
+                       return -EPERM;
+               }
        }
        if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) &&
            !(mnt_flags & MNT_NOSUID)) {


Patches currently in stable-queue which might be from [email protected] are

queue-3.18/mnt-update-unprivileged-remount-test.patch
queue-3.18/mnt-fix-a-memory-stomp-in-umount.patch
queue-3.18/userns-check-euid-no-fsuid-when-establishing-an-unprivileged-uid-mapping.patch
queue-3.18/mnt-implicitly-add-mnt_nodev-on-remount-when-it-was-implicitly-added-by-mount.patch
queue-3.18/userns-don-t-allow-unprivileged-creation-of-gid-mappings.patch
queue-3.18/userns-rename-id_map_mutex-to-userns_state_mutex.patch
queue-3.18/userns-add-a-knob-to-disable-setgroups-on-a-per-user-namespace-basis.patch
queue-3.18/userns-allow-setting-gid_maps-without-privilege-when-setgroups-is-disabled.patch
queue-3.18/userns-don-t-allow-setgroups-until-a-gid-mapping-has-been-setablished.patch
queue-3.18/groups-consolidate-the-setgroups-permission-checks.patch
queue-3.18/userns-only-allow-the-creator-of-the-userns-unprivileged-mappings.patch
queue-3.18/userns-document-what-the-invariant-required-for-safe-unprivileged-mappings.patch
queue-3.18/umount-disallow-unprivileged-mount-force.patch
queue-3.18/userns-unbreak-the-unprivileged-remount-tests.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to