76 lines
3.2 KiB
Diff
76 lines
3.2 KiB
Diff
From 7dd643f8005449c3e34643f2cb85fcbab8011482 Mon Sep 17 00:00:00 2001
|
|
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
Date: Fri, 18 Jul 2025 18:03:49 +0200
|
|
Subject: [PATCH 091/115] i386/tdx: Clarify the error message of
|
|
mrconfigid/mrowner/mrownerconfig
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
RH-MergeRequest: 391: TDX support, including attestation and device assignment
|
|
RH-Jira: RHEL-15710 RHEL-20798 RHEL-49728
|
|
RH-Acked-by: Yash Mankad <None>
|
|
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
RH-Commit: [91/115] 5f8559f8d9f842f79916f49f4806dd4cf2f8c686 (bonzini/rhel-qemu-kvm)
|
|
|
|
The error message is misleading - we successfully decoded the data,
|
|
the decoded data was simply with the wrong length.
|
|
|
|
Change the error message to show it is an length check failure with both
|
|
the received and expected values.
|
|
|
|
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
|
|
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
|
Link: https://lore.kernel.org/r/20250603050305.1704586-4-xiaoyao.li@intel.com
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
(cherry picked from commit 41cd354d350d3c64915be9c5decbf20abd84e486)
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
---
|
|
target/i386/kvm/tdx.c | 12 +++++++++---
|
|
1 file changed, 9 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
|
|
index ca3641441c..ed3a55991a 100644
|
|
--- a/target/i386/kvm/tdx.c
|
|
+++ b/target/i386/kvm/tdx.c
|
|
@@ -1032,7 +1032,9 @@ int tdx_pre_create_vcpu(CPUState *cpu, Error **errp)
|
|
return -1;
|
|
}
|
|
if (data_len != QCRYPTO_HASH_DIGEST_LEN_SHA384) {
|
|
- error_setg(errp, "TDX: failed to decode mrconfigid");
|
|
+ error_setg(errp, "TDX 'mrconfigid' sha384 digest was %ld bytes, "
|
|
+ "expected %d bytes", data_len,
|
|
+ QCRYPTO_HASH_DIGEST_LEN_SHA384);
|
|
return -1;
|
|
}
|
|
memcpy(init_vm->mrconfigid, data, data_len);
|
|
@@ -1045,7 +1047,9 @@ int tdx_pre_create_vcpu(CPUState *cpu, Error **errp)
|
|
return -1;
|
|
}
|
|
if (data_len != QCRYPTO_HASH_DIGEST_LEN_SHA384) {
|
|
- error_setg(errp, "TDX: failed to decode mrowner");
|
|
+ error_setg(errp, "TDX 'mrowner' sha384 digest was %ld bytes, "
|
|
+ "expected %d bytes", data_len,
|
|
+ QCRYPTO_HASH_DIGEST_LEN_SHA384);
|
|
return -1;
|
|
}
|
|
memcpy(init_vm->mrowner, data, data_len);
|
|
@@ -1058,7 +1062,9 @@ int tdx_pre_create_vcpu(CPUState *cpu, Error **errp)
|
|
return -1;
|
|
}
|
|
if (data_len != QCRYPTO_HASH_DIGEST_LEN_SHA384) {
|
|
- error_setg(errp, "TDX: failed to decode mrownerconfig");
|
|
+ error_setg(errp, "TDX 'mrownerconfig' sha384 digest was %ld bytes, "
|
|
+ "expected %d bytes", data_len,
|
|
+ QCRYPTO_HASH_DIGEST_LEN_SHA384);
|
|
return -1;
|
|
}
|
|
memcpy(init_vm->mrownerconfig, data, data_len);
|
|
--
|
|
2.50.1
|
|
|