[libvirt] [PATCH 30/30] security: selinux: Label externalDataStore

Daniel Henrique Barboza danielhb413 at gmail.com
Thu Oct 10 16:11:36 UTC 2019



On 10/7/19 6:49 PM, Cole Robinson wrote:
> We mirror the labeling strategy that was used for its top image
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---

Reviewed-by: Daniel Henrique Barboza <danielhb413 at gmail.com>

>   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 feb703d325..2a3b7fc10d 100644
> --- a/src/security/security_selinux.c
> +++ b/src/security/security_selinux.c
> @@ -1844,7 +1844,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))
> @@ -1931,6 +1931,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;
>       }




More information about the libvir-list mailing list