]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virt-aa-helper: grant locking permission on -f
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Tue, 24 Oct 2017 14:54:59 +0000 (16:54 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 26 Oct 2017 10:48:32 +0000 (12:48 +0200)
Hot-adding disks does not parse the full XML to generate apparmor rules.
Instead it uses -f <PATH> to append a generic rule for that file path.

580cdaa7: "virt-aa-helper: locking disk files for qemu 2.10" implemented
the qemu 2.10 requirement to allow locking on disks images that are part of
the domain xml.

But on attach-device a user will still trigger an apparmor deny by going
through virt-aa-helper -f, to fix that add the lock "k" permission to the
append file case of virt-aa-helper.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
src/security/virt-aa-helper.c

index ef1bf0136f90c7bb7f676c2de71ecf5ed822d612..ee3913d66ac3a867bae6af71609ebcd25dd25ae2 100644 (file)
@@ -1157,7 +1157,7 @@ get_files(vahControl * ctl)
     }
 
     if (ctl->newfile)
-        if (vah_add_file(&buf, ctl->newfile, "rw") != 0)
+        if (vah_add_file(&buf, ctl->newfile, "rwk") != 0)
             goto cleanup;
 
     if (virBufferError(&buf)) {
@@ -1341,7 +1341,7 @@ main(int argc, char **argv)
             vah_error(ctl, 1, _("profile exists"));
 
         if (ctl->append && ctl->newfile) {
-            if (vah_add_file(&buf, ctl->newfile, "rw") != 0)
+            if (vah_add_file(&buf, ctl->newfile, "rwk") != 0)
                 goto cleanup;
         } else {
             if (ctl->def->virtType == VIR_DOMAIN_VIRT_QEMU ||