]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Extend TPM ABI stability check for <active_pcr_banks/>
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 4 Jan 2022 08:26:08 +0000 (09:26 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 4 Jan 2022 08:42:01 +0000 (09:42 +0100)
Changing <active_pcr_banks/> means changing the guest ABI and as
such must be prevented on both restoring from a file or
migration.

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

index 716c6d2240077ca5db6003f917a971058bd0d577..bba662bf4ccdb303abb680bf39c57f21fc80c22a 100644 (file)
@@ -21994,6 +21994,20 @@ virDomainTPMDefCheckABIStability(virDomainTPMDef *src,
         return false;
     }
 
+    switch (src->type) {
+    case VIR_DOMAIN_TPM_TYPE_EMULATOR:
+        if (src->data.emulator.activePcrBanks != dst->data.emulator.activePcrBanks) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Target active PCR banks doesn't match source"));
+            return false;
+        }
+        break;
+
+    case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
+    case VIR_DOMAIN_TPM_TYPE_LAST:
+        break;
+    }
+
     return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info);
 }