]> git.proxmox.com Git - swtpm.git/commit
control channel: add error logs upon receiving short input
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 18 Jan 2023 12:21:07 +0000 (13:21 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 23 Feb 2023 11:51:37 +0000 (12:51 +0100)
commite8249e7742faf174018862174b85df1332171d6d
tree1e4b26988ef877db76d38618f677c697a197e35d
parent7f00c6633e22c55f7f86a88c7a448d32e7704890
control channel: add error logs upon receiving short input

There was a recent failure when migrating a production VM
> kvm: tpm-emulator: Setting the stateblob (type 1) failed with a TPM error 0x3 a parameter is bad
> kvm: error while loading state for instance 0x0 of device 'tpm-emulator'
> kvm: load of migration failed: Input/output error
and it's not clear what exactly triggered it. Note that 0x3 is
TPM_BAD_PARAMETER.

The timeout check when receiving the command+body is a good candidate,
but since poll() is called with the remaining timeout, it seems hard
to trigger. In both cases with short input, QEMU would've not managed
to even send the full header (16 bytes for CMD_SET_STATEBLOB).

Another possibility is that the blob header got corrupted and the
TPM_BAD_PARAMETER error orignated from the SWTPM_NVRAM_SetStateBlob()
call. The checks there already have logging.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
src/swtpm/ctrlchannel.c