This is a note to let you know that I've just added the patch titled
mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into
do_remount
to the 3.14-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-move-the-test-for-mnt_lock_readonly-from-change_mount_flags-into-do_remount.patch
and it can be found in the queue-3.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 07b645589dcda8b7a5249e096fece2a67556f0f4 Mon Sep 17 00:00:00 2001
From: "Eric W. Biederman" <[email protected]>
Date: Mon, 28 Jul 2014 17:10:56 -0700
Subject: mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into
do_remount
From: "Eric W. Biederman" <[email protected]>
commit 07b645589dcda8b7a5249e096fece2a67556f0f4 upstream.
There are no races as locked mount flags are guaranteed to never change.
Moving the test into do_remount makes it more visible, and ensures all
filesystem remounts pass the MNT_LOCK_READONLY permission check. This
second case is not an issue today as filesystem remounts are guarded
by capable(CAP_DAC_ADMIN) and thus will always fail in less privileged
mount namespaces, but it could become an issue in the future.
Acked-by: Serge E. Hallyn <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
fs/namespace.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1887,9 +1887,6 @@ static int change_mount_flags(struct vfs
if (readonly_request == __mnt_is_readonly(mnt))
return 0;
- if (mnt->mnt_flags & MNT_LOCK_READONLY)
- return -EPERM;
-
if (readonly_request)
error = mnt_make_readonly(real_mount(mnt));
else
@@ -1915,6 +1912,16 @@ static int do_remount(struct path *path,
if (path->dentry != path->mnt->mnt_root)
return -EINVAL;
+ /* Don't allow changing of locked mnt flags.
+ *
+ * No locks need to be held here while testing the various
+ * MNT_LOCK flags because those flags can never be cleared
+ * once they are set.
+ */
+ if ((mnt->mnt.mnt_flags & MNT_LOCK_READONLY) &&
+ !(mnt_flags & MNT_READONLY)) {
+ return -EPERM;
+ }
err = security_sb_remount(sb, data);
if (err)
return err;
Patches currently in stable-queue which might be from [email protected] are
queue-3.14/mnt-correct-permission-checks-in-do_remount.patch
queue-3.14/mnt-only-change-user-settable-mount-flags-in-remount.patch
queue-3.14/mnt-add-tests-for-unprivileged-remount-cases-that-have-found-to-be-faulty.patch
queue-3.14/mnt-change-the-default-remount-atime-from-relatime-to-the-existing-value.patch
queue-3.14/mnt-move-the-test-for-mnt_lock_readonly-from-change_mount_flags-into-do_remount.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