]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: backup: Restore security label on backup disk store image on VM termination
authorPeter Krempa <pkrempa@redhat.com>
Wed, 17 Mar 2021 15:30:31 +0000 (16:30 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 19 Mar 2021 15:41:39 +0000 (16:41 +0100)
commit8967ad7be652f9949339748ce0f24e4ce0ade707
treeb20c93be70d5686db7e81cb78c59f8ba6d981424
parent218d4cf4331eaeaa522e3c4acc6bb7be870ffe3a
qemu: backup: Restore security label on backup disk store image on VM termination

When the backup job is terminated normally the security label is
restored by the blockjob finishing handler.

If the VM dies or is destroyed that wouldn't happen as the blockjob
handler wouldn't be called.

Restore the security label on disk store where we remember that the job
was running at the point when 'qemuBackupJobTerminate' was called.

Not resetting the security label means that we also leak the xattr
attributes remembering the label which prevents any further use of the
file, which is a problem for block devices.

This also requires that the call to 'qemuBackupJobTerminate' from
'qemuProcessStop' happens only after 'vm->pid' was reset as otherwise
the security subdrivers attempt to enter the process namespace which
fails if the process isn't running any more.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1939082
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_backup.c
src/qemu/qemu_process.c