qemu: Use qemuSecurityDomainSetPathLabel() to set seclabes on not saved state files

There are two places within qemu driver that misuse
qemuSecuritySetSavedStateLabel() to set seclabels on tempfiles
that are not state files: qemuDomainScreenshot() and
qemuDomainMemoryPeek(). They are doing so because of lack of
qemuSecurityDomainSetPathLabel() at the time of their
introduction.

In all three secdrivers (well, four if you count NOP driver) the
implementation of .domainSetSavedStateLabel and
.domainSetPathLabel callbacks is the same anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Michal Privoznik 2020-06-17 11:01:05 +02:00
parent 4c3e83ccfb
commit 8c62579424

View File

@ -4064,7 +4064,7 @@ qemuDomainScreenshot(virDomainPtr dom,
}
unlink_tmp = true;
qemuSecuritySetSavedStateLabel(driver, vm, tmp);
qemuSecurityDomainSetPathLabel(driver, vm, tmp, false);
qemuDomainObjEnterMonitor(driver, vm);
if (qemuMonitorScreendump(priv->mon, videoAlias, screen, tmp) < 0) {
@ -11671,7 +11671,7 @@ qemuDomainMemoryPeek(virDomainPtr dom,
goto endjob;
}
qemuSecuritySetSavedStateLabel(driver, vm, tmp);
qemuSecurityDomainSetPathLabel(driver, vm, tmp, false);
priv = vm->privateData;
qemuDomainObjEnterMonitor(driver, vm);