···11-From 7415cb7b31569e9266229d4ebc79ccec4841ab04 Mon Sep 17 00:00:00 2001
22-From: Serge Hallyn <serge.hallyn@ubuntu.com>
33-Date: Fri, 7 Feb 2014 09:32:46 -0600
44-Subject: [PATCH] UBUNTU: SAUCE: Overlayfs: allow unprivileged mounts
55-66-Unprivileged mounting, here, refers to root in a non-initial user
77-namespace performing the mount. In particular, it requires
88-CAP_SYS_ADMIN toward the task's mounts namespace, alleviating
99-the concerns of manipulating mount environment for setuid-root
1010-binaries on the host.
1111-1212-We refuse unprivileged mounting of most filesystem types because
1313-we do not trust the in-kernel superblock parsers to correctly
1414-handle malicious input.
1515-1616-However, overlayfs does not parse any user-provided data other
1717-than the pathnames passed in. Therefore unprivileged mounting
1818-of overlayfs should be safe.
1919-2020-Allowing unprivileged mounting of overlayfs filesystems would
2121-allow Ubuntu Trusty users to create overlayfs-based container
2222-snapshots, which would be a huge usability improvement.
2323-2424-This patch enables unprivileged mounting of overlayfs.
2525-2626-I tested a few simple combinations, and found that, when
2727-doing (the equivalent of)
2828-2929-mount -t overlayfs -oupperdir=u,lowerdir=l l t
3030-3131-(u for upper, l for lower, t for target),
3232-3333-1. overlayfs mount is always allowed, regardless of ownership
3434-of u, l, or t. However
3535-3636-2. Creation of new files is allowed so long as u is owned by
3737- T. Otherwise, regardless of ownerships of l and t it is
3838- denied. (This is expected; t was the mountpoint and
3939- 'disapears', so its ownership is irrelevant)
4040-4141-3. modification of a file 'hithere' which is in l but not yet
4242- in u, and which is not owned by T, is not allowed, even if
4343- writes to u are allowed. This may be a bug in overlayfs,
4444- but it is safe behavior. It also will not cause a problem
4545- for lxc since lxc will ensure that files are mapped into T's
4646- namespace.
4747-4848-Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
4949-Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
5050-Signed-off-by: Andy Whitcroft <apw@canonical.com>
5151----
5252- fs/overlayfs/super.c | 1 +
5353- 1 file changed, 1 insertion(+)
5454-5555-diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
5656-index 9473e79..50890c2 100644
5757---- a/fs/overlayfs/super.c
5858-+++ b/fs/overlayfs/super.c
5959-@@ -668,6 +668,7 @@ static struct file_system_type ovl_fs_type = {
6060- .name = "overlayfs",
6161- .mount = ovl_mount,
6262- .kill_sb = kill_anon_super,
6363-+ .fs_flags = FS_USERNS_MOUNT,
6464- };
6565- MODULE_ALIAS_FS("overlayfs");
6666-6767---
6868-2.1.0.rc1
6969-