From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) Subject: [REVIEW][0/5] Fixing unprivileged mount -o remount,ro Date: Tue, 29 Jul 2014 20:38:45 -0700 Message-ID: <87siljjz22.fsf_-_@x220.int.ebiederm.org> References: <87fvih4a99.fsf@x220.int.ebiederm.org> <8761injfj9.fsf_-_@x220.int.ebiederm.org> <87lhrihaan.fsf@x220.int.ebiederm.org> <20140724194920.GU26600@ubuntumail> <8738dqh2j1.fsf@x220.int.ebiederm.org> <20140725060810.GC31313@1wt.eu> <877g2xou2u.fsf@x220.int.ebiederm.org> <87r415nf3k.fsf_-_@x220.int.ebiederm.org> <874my1neyr.fsf_-_@x220.int.ebiederm.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: (Kenton Varda's message of "Tue, 29 Jul 2014 15:09:25 -0700") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Linux Containers Cc: Andrew Lutomirski , security-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Serge Hallyn , Al Viro , Willy Tarreau List-Id: containers.vger.kernel.org This patchset addresses a nasty bug where "unshare --user --mount mount --bind -o remount,ro /path" would allow a following "mount --bind -o remount,rw" to succeed even when /path started out read-only in the initial mount namespace. The fixes are quite simple and since they are user namespace specific I plan on carrying them in my user namespace tree and ultimately pushing them to Linus. If anyone has any concerns about the code before I do that please speak up so the issues can be addressed. Eric W. Biederman (5): mnt: Only change user settable mount flags in remount mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remount mnt: Correct permission checks in do_remount mnt: Change the default remount atime from relatime to the existing value mnt: Add tests for unprivileged remount cases that have found to be faulty fs/namespace.c | 59 ++++- include/linux/mount.h | 9 +- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/mount/Makefile | 17 ++ .../selftests/mount/unprivileged-remount-test.c | 242 +++++++++++++++++++++ 5 files changed, 320 insertions(+), 8 deletions(-) Eric