mnt: Only change user settable mount flags in remount
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 28 Jul 2014 23:26:53 +0000 (16:26 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Sep 2014 16:19:21 +0000 (09:19 -0700)
commit98e68ce8f4a6d3ad72243eecd1022ba120b515d2
tree0ed18ecec593f35ee55a409dfd0fd951ce49d94a
parent75ad07770409c4f794a87695cb0661b8e358d6b4
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/namespace.c
include/linux/mount.h