[libvirt] [PATCH v2] security: apparmor: Label externalDataStore

Cole Robinson posted 1 patch 4 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/69c33aac22f5911bb800fe41b62e704fe24cd4ce.1575939270.git.crobinso@redhat.com
src/security/virt-aa-helper.c | 4 ++++
1 file changed, 4 insertions(+)
[libvirt] [PATCH v2] security: apparmor: Label externalDataStore
Posted by Cole Robinson 4 years, 3 months ago
Teach virt-aa-helper how to label a qcow2 data_file, tracked internally
as externalDataStore. It should be treated the same as its sibling
disk image

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
v2:
s/src/tmp/

 src/security/virt-aa-helper.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index c93dddb228..f623ff965f 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -918,6 +918,10 @@ storage_source_add_files(virStorageSourcePtr src,
         if (add_file_path(tmp, depth, buf) < 0)
             return -1;
 
+        if (tmp->externalDataStore &&
+            storage_source_add_files(tmp->externalDataStore, buf, depth) < 0)
+            return -1;
+
         depth++;
     }
 
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2] security: apparmor: Label externalDataStore
Posted by Christian Ehrhardt 4 years, 3 months ago
On Tue, Dec 10, 2019 at 1:54 AM Cole Robinson <crobinso@redhat.com> wrote:

> Teach virt-aa-helper how to label a qcow2 data_file, tracked internally
> as externalDataStore. It should be treated the same as its sibling
> disk image
>
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
>

Now LGTM, thanks for the rework.
And after Peters explanation (thanks) I agree that it is the right approach
to do it inside the loop.

Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>


> ---
> v2:
> s/src/tmp/
>
>  src/security/virt-aa-helper.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
> index c93dddb228..f623ff965f 100644
> --- a/src/security/virt-aa-helper.c
> +++ b/src/security/virt-aa-helper.c
> @@ -918,6 +918,10 @@ storage_source_add_files(virStorageSourcePtr src,
>          if (add_file_path(tmp, depth, buf) < 0)
>              return -1;
>
> +        if (tmp->externalDataStore &&
> +            storage_source_add_files(tmp->externalDataStore, buf, depth)
> < 0)
> +            return -1;
> +
>          depth++;
>      }
>
> --
> 2.23.0
>
>

-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list