When SNP_LAUNCH_UPDATE fails to update the CPUID page, the CPUID page data passed in will be re-written with metadata about what CPUID fields didn't match with what trusted firmware expected. In the case of in-place conversion, this will have been the same page that was initially passed to SNP_LAUNCH_UPDATE, and so it will have been put in a private state prior to making the call. Make sure to switch it back to shared before accessing it for error-reporting, otherwise this path will generate a bus error. While here, sneak in a typo fixup for the error message that gets printed immediately afterward. Signed-off-by: Michael Roth --- target/i386/sev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index b28a31b7bf..e15e23c78d 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1278,8 +1278,14 @@ sev_snp_launch_update(SevSnpGuestState *sev_snp_guest, ret, fw_error, fw_error_to_str(fw_error)); if (data->type == KVM_SEV_SNP_PAGE_TYPE_CPUID) { + if (convert_in_place && + kvm_set_memory_attributes_shared(data->gpa, data->len)) { + error_report("SEV-SNP: unable to access CPUID page to " + "check failure reasons"); + goto out; + } sev_snp_cpuid_report_mismatches(&snp_cpuid_info, data->hva); - error_report("SEV-SNP: failed update CPUID page"); + error_report("SEV-SNP: failed to update CPUID page"); } break; } -- 2.43.0