]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Don't mount selinux fs in LXC if selinux is disabled
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 15 May 2013 15:26:59 +0000 (16:26 +0100)
committerJim Fehlig <jfehlig@suse.com>
Thu, 11 Jul 2013 16:52:04 +0000 (10:52 -0600)
Before trying to mount the selinux filesystem in a container
use is_selinux_enabled() to check if the machine actually
has selinux support (eg not booted with selinux=0)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 95c6cc344bec8405636d2a59fc0c34e0581001ab)

src/lxc/lxc_container.c

index 86746df5fa6ea940d5a8e67945c5bb2fd8e7a61f..c9c11e8575f9c039d4074a189d5b125f8aba0f91 100644 (file)
@@ -705,6 +705,12 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
             (access(srcpath, R_OK) < 0))
             continue;
 
+#if WITH_SELINUX
+        if (STREQ(mnts[i].src, SELINUX_MOUNT) &&
+            !is_selinux_enabled())
+            continue;
+#endif
+
         if (virFileMakePath(mnts[i].dst) < 0) {
             virReportSystemError(errno,
                                  _("Failed to mkdir %s"),