[pve-devel] [PATCH qemu-server 2/3] swtpm: check that format of tpmstate volume is raw

Fiona Ebner f.ebner at proxmox.com
Thu Dec 12 10:11:36 CET 2024


Am 12.12.24 um 09:51 schrieb Fabian Grünbichler:
> since swtpm currently doesn't support anything else, and might overwrite a file
> using qcow2 or vmdk format by accident..
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>

Except the nit below

Reviewed-by: Fiona Ebner <f.ebner at proxmox.com>

> ---
>  PVE/QemuServer.pm | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 8192599a..fe7984eb 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -3212,6 +3212,8 @@ sub start_swtpm {
>      my $tpm = parse_drive("tpmstate0", $tpmdrive);
>      my ($storeid, $volname) = PVE::Storage::parse_volume_id($tpm->{file}, 1);
>      if ($storeid) {
> +	my $format = checked_volume_format($storecfg, $tpm->{file});
> +	die "swtpm currently only supports 'raw' state volumes" if $format ne 'raw';

Missing newline after error message.

Can we add a format check in create_disks() when creating/adding the
volume as tpmstate0 too, please :)?

>  	$state = PVE::Storage::map_volume($storecfg, $tpm->{file});
>      } else {
>  	$state = $tpm->{file};





More information about the pve-devel mailing list