]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
selinux: Always generate imagelabel
authorPeter Krempa <pkrempa@redhat.com>
Tue, 2 Jul 2013 16:34:58 +0000 (18:34 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 8 Jul 2013 13:04:20 +0000 (15:04 +0200)
The imagelabel SELinux label was only generated when relabeling was
enabled. This prohibited labeling of files created by libvirt that need
to be labeled even if relabeling is turned off.

The only codepath this change has direct impact on is labeling of FDs
passed to qemu which is always safe in current state.

src/security/security_selinux.c

index ec4f764e4aac9d63de09d26d1cec793d9f0cb993..d7c978dbeae6c0a0d9a81b41f536d2fbb98219ed 100644 (file)
@@ -687,13 +687,12 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
         goto cleanup;
     }
 
-    if (!seclabel->norelabel) {
-        seclabel->imagelabel = virSecuritySELinuxGenNewContext(data->file_context,
-                                                               mcs,
-                                                               true);
-        if (!seclabel->imagelabel)
-            goto cleanup;
-    }
+    /* always generate a image label, needed to label new objects */
+    seclabel->imagelabel = virSecuritySELinuxGenNewContext(data->file_context,
+                                                           mcs,
+                                                           true);
+    if (!seclabel->imagelabel)
+        goto cleanup;
 
     if (!seclabel->model &&
         VIR_STRDUP(seclabel->model, SECURITY_SELINUX_NAME) < 0)