From: Serge Hallyn Date: Mon, 10 Jun 2013 14:34:06 +0000 (-0500) Subject: conf.c: if we don't specify a rootfs, we still need proc mounted X-Git-Tag: lxc-1.0.0.alpha1~1^2~158 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e46cfcb0e4fcaa2d920a3c473f83c0a73c68cfa;p=thirdparty%2Flxc.git conf.c: if we don't specify a rootfs, we still need proc mounted otherwise we won't be allowed to set an apparmor context (on pid 1) Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index a1aee141f..5700effa8 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -2851,9 +2851,13 @@ 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)) { + SYSERROR("Failed mounting /proc, proceeding"); + mounted = 0; + } else + 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.");