commit 6079922050b5c5db19c7e19fae7a398ff3502523
parent 2b331b911f86f0d04eb9400a403105753ed5b69a
Author: Michael Roth <michael.roth@amd.com>
Date: Thu, 23 Dec 2021 10:11:44 -0600
i386/sev: fix launch measurement crash for SEV-SNP
Launch measurement measurement is not supported for SEV-SNP guests
since it is reported later for checking during attestation workflow.
For SEV-SNP, QEMU's launch measurement is meant to be a no-op, but
currently results in a crash. Fix that.
Reported-by: Niteesh Dubey <niteesh@us.ibm.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
@@ -1173,7 +1173,9 @@ free_measurement:
char *
sev_get_launch_measurement(void)
{
- SevGuestState *sev_guest = SEV_GUEST(MACHINE(qdev_get_machine())->cgs);
+ ConfidentialGuestSupport *cgs = MACHINE(qdev_get_machine())->cgs;
+ SevGuestState *sev_guest =
+ (SevGuestState *)object_dynamic_cast(OBJECT(cgs), TYPE_SEV_GUEST);
if (sev_guest &&
SEV_COMMON(sev_guest)->state >= SEV_STATE_LAUNCH_SECRET) {