From 36138eaecf8920d843ca3b1cec38cc765369144c Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 7 Oct 2019 16:20:16 -0400 Subject: [PATCH] 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 --- src/security/security_selinux.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; } -- 2.39.5