[lxc-devel] [PATCH] specify mode whenever mounting tmpfs

Serge Hallyn serge.hallyn at ubuntu.com
Fri Jan 31 09:51:21 UTC 2014


Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/cgmanager.c | 2 +-
 src/lxc/conf.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lxc/cgmanager.c b/src/lxc/cgmanager.c
index f5d42ff..4241ca0 100644
--- a/src/lxc/cgmanager.c
+++ b/src/lxc/cgmanager.c
@@ -697,7 +697,7 @@ static bool cgm_bind_dir(const char *root, const char *dirname)
 	}
 
 	/* mount a tmpfs there so we can create subdirs */
-	if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000")) {
+	if (mount("cgroup", cgpath, "tmpfs", 0, "size=10000,mode=755")) {
 		SYSERROR("Failed to mount tmpfs at %s", cgpath);
 		return false;
 	}
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 180c51e..c099ae5 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1321,7 +1321,7 @@ static int mount_autodev(const char *name, char *root, const char *lxcpath)
 		/* Only mount a tmpfs on here if we don't already a mount */
 		if ( ! mount_check_fs( host_path, NULL ) ) {
 			DEBUG("Mounting tmpfs to %s", host_path );
-			ret = mount("none", path, "tmpfs", 0, "size=100000");
+			ret = mount("none", path, "tmpfs", 0, "size=100000,mode=755");
 		} else {
 			/* This allows someone to manually set up a mount */
 			DEBUG("Bind mounting %s to %s", host_path, path );
@@ -1471,7 +1471,7 @@ static int chroot_into_slave(struct lxc_conf *conf)
 		SYSERROR("failed to make %s slave", destpath);
 		return -1;
 	}
-	if (mount("none", destpath, "tmpfs", 0, "size=10000")) {
+	if (mount("none", destpath, "tmpfs", 0, "size=10000,mode=755")) {
 		SYSERROR("Failed to mount tmpfs / at %s", destpath);
 		return -1;
 	}
-- 
1.9.rc1



More information about the lxc-devel mailing list