summaryrefslogtreecommitdiff
path: root/include/linux/mount.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2014-07-29 03:26:53 +0400
committerZefan Li <lizefan@huawei.com>2014-12-01 13:02:42 +0300
commitb47d65db8f8e765ef0267d13681c9bf12a148fb5 (patch)
treebae1470ac9ca843e700bbf3a6008f179c377dbe8 /include/linux/mount.h
parentae552f6b54840fc7fb7a7ee688632b55e7eb9cef (diff)
downloadlinux-b47d65db8f8e765ef0267d13681c9bf12a148fb5.tar.xz
mnt: Only change user settable mount flags in remount
commit a6138db815df5ee542d848318e5dae681590fccd upstream. Kenton Varda <kenton@sandstorm.io> discovered that by remounting a read-only bind mount read-only in a user namespace the MNT_LOCK_READONLY bit would be cleared, allowing an unprivileged user to the remount a read-only mount read-write. Correct this by replacing the mask of mount flags to preserve with a mask of mount flags that may be changed, and preserve all others. This ensures that any future bugs with this mask and remount will fail in an easy to detect way where new mount flags simply won't change. Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Francis Moreau <francis.moro@gmail.com> Signed-off-by: Zefan Li <lizefan@huawei.com>
Diffstat (limited to 'include/linux/mount.h')
-rw-r--r--include/linux/mount.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/mount.h b/include/linux/mount.h
index d7029f4a191a..2044aacc0d2b 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -42,7 +42,9 @@ struct mnt_namespace;
* flag, consider how it interacts with shared mounts.
*/
#define MNT_SHARED_MASK (MNT_UNBINDABLE)
-#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE)
+#define MNT_USER_SETTABLE_MASK (MNT_NOSUID | MNT_NODEV | MNT_NOEXEC \
+ | MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME \
+ | MNT_READONLY)
#define MNT_INTERNAL 0x4000