]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Restore label to temp file in qemuDomainScreenshot()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 2 Jun 2022 12:05:25 +0000 (14:05 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 2 Jun 2022 15:03:43 +0000 (17:03 +0200)
commit8d2567bccff06ee99064efdcfbc22cdaf5611d97
treeb741269fbb6cfb3243400af1f3f6a2391e93f49f
parent215b2466cd45bd00d4d71db40364384c0bf9313d
qemu: Restore label to temp file in qemuDomainScreenshot()

Obtaining a screenshot via virDomainScreenshot() works like this:
  1) we create a temp file, label it, then
  2) tell QEMU to store the screenshot into it, and
  3) finally, open the file for transfer via virStream

Since the file is just temporary and even explicitly unlinked at
the end, no seclabel restoration is done. This makes perfect
sense for security models which attach a label to file itself
(DAC, SELinux) because the label is gone with the file. However,
for models where a list of files and allowed actions is kept on a
side (AppArmor) this approach means we just append files into the
profile and never remove them. In turn, the file grows and policy
update takes longer with each entry.

Restore the seclabel for AppArmor's sake.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_driver.c