lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 16.09-beta 69 lines 2.4 kB view raw
1From 7415cb7b31569e9266229d4ebc79ccec4841ab04 Mon Sep 17 00:00:00 2001 2From: Serge Hallyn <serge.hallyn@ubuntu.com> 3Date: Fri, 7 Feb 2014 09:32:46 -0600 4Subject: [PATCH] UBUNTU: SAUCE: Overlayfs: allow unprivileged mounts 5 6Unprivileged mounting, here, refers to root in a non-initial user 7namespace performing the mount. In particular, it requires 8CAP_SYS_ADMIN toward the task's mounts namespace, alleviating 9the concerns of manipulating mount environment for setuid-root 10binaries on the host. 11 12We refuse unprivileged mounting of most filesystem types because 13we do not trust the in-kernel superblock parsers to correctly 14handle malicious input. 15 16However, overlayfs does not parse any user-provided data other 17than the pathnames passed in. Therefore unprivileged mounting 18of overlayfs should be safe. 19 20Allowing unprivileged mounting of overlayfs filesystems would 21allow Ubuntu Trusty users to create overlayfs-based container 22snapshots, which would be a huge usability improvement. 23 24This patch enables unprivileged mounting of overlayfs. 25 26I tested a few simple combinations, and found that, when 27doing (the equivalent of) 28 29mount -t overlayfs -oupperdir=u,lowerdir=l l t 30 31(u for upper, l for lower, t for target), 32 331. overlayfs mount is always allowed, regardless of ownership 34of u, l, or t. However 35 362. Creation of new files is allowed so long as u is owned by 37 T. Otherwise, regardless of ownerships of l and t it is 38 denied. (This is expected; t was the mountpoint and 39 'disapears', so its ownership is irrelevant) 40 413. modification of a file 'hithere' which is in l but not yet 42 in u, and which is not owned by T, is not allowed, even if 43 writes to u are allowed. This may be a bug in overlayfs, 44 but it is safe behavior. It also will not cause a problem 45 for lxc since lxc will ensure that files are mapped into T's 46 namespace. 47 48Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> 49Signed-off-by: Tim Gardner <tim.gardner@canonical.com> 50Signed-off-by: Andy Whitcroft <apw@canonical.com> 51--- 52 fs/overlayfs/super.c | 1 + 53 1 file changed, 1 insertion(+) 54 55diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c 56index 9473e79..50890c2 100644 57--- a/fs/overlayfs/super.c 58+++ b/fs/overlayfs/super.c 59@@ -668,6 +668,7 @@ static struct file_system_type ovl_fs_type = { 60 .name = "overlayfs", 61 .mount = ovl_mount, 62 .kill_sb = kill_anon_super, 63+ .fs_flags = FS_USERNS_MOUNT, 64 }; 65 MODULE_ALIAS_FS("overlayfs"); 66 67-- 682.1.0.rc1 69