]> xenbits.xensource.com Git - libvirt.git/commitdiff
virSecuritySELinuxRestoreAllLabel: Restore more labels
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 3 Oct 2018 09:08:21 +0000 (11:08 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 19 Dec 2018 14:32:40 +0000 (15:32 +0100)
We are setting label on kernel, initrd, dtb and slic_table files.
But we never restored it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/security/security_selinux.c

index 6c2ef22a6e6f5f7f8df977037b2bd6821f1da0bb..4de8b6f9cd81ee73958e067a4e5689c48f9714e6 100644 (file)
@@ -2668,6 +2668,22 @@ virSecuritySELinuxRestoreAllLabel(virSecurityManagerPtr mgr,
         virSecuritySELinuxRestoreFileLabel(mgr, def->os.loader->nvram, false) < 0)
         rc = -1;
 
+    if (def->os.kernel &&
+        virSecuritySELinuxRestoreFileLabel(mgr, def->os.kernel, false) < 0)
+        rc = -1;
+
+    if (def->os.initrd &&
+        virSecuritySELinuxRestoreFileLabel(mgr, def->os.initrd, false) < 0)
+        rc = -1;
+
+    if (def->os.dtb &&
+        virSecuritySELinuxRestoreFileLabel(mgr, def->os.dtb, false) < 0)
+        rc = -1;
+
+    if (def->os.slic_table &&
+        virSecuritySELinuxRestoreFileLabel(mgr, def->os.slic_table, false) < 0)
+        rc = -1;
+
     return rc;
 }