[libvirt] [PATCH 24/30] security: dac: Label externalDataStore

Cole Robinson crobinso at redhat.com
Mon Oct 7 21:49:38 UTC 2019


We mirror the labeling strategy that was used for its sibling
image

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/security/security_dac.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 326b9b1a3c..2bbf773dd3 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -882,7 +882,7 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr,
     virSecurityDeviceLabelDefPtr parent_seclabel = NULL;
     virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
     bool remember;
-    bool is_toplevel = parent == src;
+    bool is_toplevel = parent == src || parent->externalDataStore == src;
     uid_t user;
     gid_t group;
 
@@ -946,6 +946,14 @@ virSecurityDACSetImageLabelRelative(virSecurityManagerPtr mgr,
         if (virSecurityDACSetImageLabelInternal(mgr, def, n, parent) < 0)
             return -1;
 
+        if (n->externalDataStore &&
+            virSecurityDACSetImageLabelRelative(mgr,
+                                                def,
+                                                n->externalDataStore,
+                                                parent,
+                                                flags) < 0)
+            return -1;
+
         if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN))
             break;
     }
-- 
2.23.0




More information about the libvir-list mailing list