From: Cole Robinson Date: Mon, 7 Oct 2019 20:20:16 +0000 (-0400) Subject: security: selinux: Label externalDataStore X-Git-Tag: v5.9.0-rc1~279 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36138eaecf8920d843ca3b1cec38cc765369144c;p=thirdparty%2Flibvirt.git security: selinux: Label externalDataStore We mirror the labeling strategy that was used for its top image Reviewed-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik Signed-off-by: Cole Robinson --- diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 5f7c2cdb5c..6e6b758497 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1846,7 +1846,7 @@ virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr, virSecurityDeviceLabelDefPtr parent_seclabel = NULL; char *use_label = NULL; bool remember; - bool is_toplevel = parent == src; + bool is_toplevel = parent == src || parent->externalDataStore == src; int ret; if (!src->path || !virStorageSourceIsLocalStorage(src)) @@ -1933,6 +1933,14 @@ virSecuritySELinuxSetImageLabelRelative(virSecurityManagerPtr mgr, if (virSecuritySELinuxSetImageLabelInternal(mgr, def, n, parent) < 0) return -1; + if (n->externalDataStore && + virSecuritySELinuxSetImageLabelRelative(mgr, + def, + n->externalDataStore, + parent, + flags) < 0) + return -1; + if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN)) break; }