[lxc-devel] [PATCH 1/1] conf.c: if we don't specify a rootfs, we still need proc mounted
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Jun 10 14:34:06 UTC 2013
otherwise we won't be allowed to set an apparmor context (on pid 1)
Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
src/lxc/conf.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index a1aee14..4e3d605 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2851,9 +2851,11 @@ int lxc_setup(const char *name, struct lxc_conf *lxc_conf)
#if HAVE_APPARMOR /* || HAVE_SMACK || HAVE_SELINUX */
INFO("rootfs path is .%s., mount is .%s.", lxc_conf->rootfs.path,
lxc_conf->rootfs.mount);
- if (lxc_conf->rootfs.path == NULL || strlen(lxc_conf->rootfs.path) == 0)
- mounted = 0;
- else
+ if (lxc_conf->rootfs.path == NULL || strlen(lxc_conf->rootfs.path) == 0) {
+ if (mount("proc", "/proc", "proc", 0, NULL))
+ return -1;
+ mounted = 1;
+ } else
mounted = lsm_mount_proc_if_needed(lxc_conf->rootfs.path, lxc_conf->rootfs.mount);
if (mounted == -1) {
SYSERROR("failed to mount /proc in the container.");
--
1.7.9.5
More information about the lxc-devel
mailing list