]> xenbits.xensource.com Git - libvirt.git/commit
apparmor: let AppArmorSetSecurityImageLabel append rules
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Wed, 16 Oct 2019 07:35:27 +0000 (09:35 +0200)
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>
Thu, 21 Nov 2019 07:26:07 +0000 (08:26 +0100)
commitd53f4d02d032ec14391b5052ec165105dfc338b5
tree751be021f339b0b0089f52bcf7a2199ab73337f2
parent9714f270f1e94a4b46a066a623b2cd239fa70faf
apparmor: let AppArmorSetSecurityImageLabel append rules

There are currently broken use cases, e.g. snapshotting more than one disk at
once like:
 $ virsh snapshot-create-as --domain eoan --disk-only --atomic
   --diskspec vda,snapshot=no  --diskspec vdb,snapshot=no
   --diskspec vdc,file=/test/disk1.snapshot1.qcow,snapshot=external
   --diskspec vdd,file=/test/disk2.snapshot1.qcow,snapshot=external
The command above will iterate from qemuDomainSnapshotCreateDiskActive and
eventually add /test/disk1.snapshot1.qcow first (appears in the rules)
to then later add /test/disk2.snapshot1.qcow and while doing so throwing
away the former rule causing it to fail.

All other calls to (re)load_profile already use append=true when adding
rules append=false is only used when restoring rules [1].

Fix this by letting AppArmorSetSecurityImageLabel use append=true as well.

Since this is removing a (unintentional) trigger to revoke all rules
appended so far we agreed on review to do some tests, but in the tests
no rules came back on:
- hot-plug
- hot-unplug
- snapshotting

Bugs:
https://bugs.launchpad.net/libvirt/+bug/1845506
https://bugzilla.redhat.com/show_bug.cgi?id=1746684

[1]: https://bugs.launchpad.net/libvirt/+bug/1845506/comments/13

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Acked-by: Jamie Strandboge <jamie@canonical.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
src/security/security_apparmor.c