]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_tpm: Generate log file path among with storage path
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 24 Feb 2021 16:28:42 +0000 (17:28 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Mar 2021 08:45:49 +0000 (09:45 +0100)
commit25ebb45a81603335b6e2344c633ef925c1c6b520
treee4f9360340285414f965106f61f66bde882a78ef
parentf9cd29a2e44d61da0fc94f245d27206ea66e1161
qemu_tpm: Generate log file path among with storage path

When starting a guest with TPM of type='emulator' an external
process is started with it (swtpm) to emulate TPM. This external
process is passed path to a log file via --logfile. The path to
the log file is generated in qemuTPMEmulatorPrepareHost() which
works, until the daemon is restarted. The problem is that the
path is not stored in private data or anywhere inside live XML
and thus later, when qemuExtTPMStop() is called (when shutting
off the guest) the stored logpath is NULL and thus its seclabel
is not cleaned up (see virSecuritySELinuxRestoreTPMLabels()).

Fortunately, qemuExtDevicesStop() (which calls qemuExtTPMStop()
eventually) does call qemuExtDevicesInitPaths() where the log
path can be generated again.

Basically, tpm->data.emulator.storagepath is generated in
qemuExtTPMInitPaths() and its seclabels are restored properly,
and this commit move logfile onto the same level.

This means, that the log path doesn't have to be generated in
qemuExtDevicesStart() because it was already done in
qemuExtDevicesPrepareHost().

This change also renders @vmname argument of
qemuTPMEmulatorPrepareHost() unused and thus is removed.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1769196
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_extdevice.c
src/qemu/qemu_tpm.c