From: Igor Mammedov <imammedo@redhat.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] i386/tdx: Clarify the error message of mrconfigid/mrowner/mrownerconfig
Date: Tue, 3 Jun 2025 11:27:05 +0200 [thread overview]
Message-ID: <20250603112705.58ca139a@imammedo.users.ipa.redhat.com> (raw)
In-Reply-To: <20250603050305.1704586-4-xiaoyao.li@intel.com>
On Tue, 3 Jun 2025 01:03:05 -0400
Xiaoyao Li <xiaoyao.li@intel.com> wrote:
> 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: Igor Mammedov <imammedo@redhat.com>
> ---
> Suggested by Daniel at https://lore.kernel.org/qemu-devel/aBzT3TrdldaN-uqx@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 17e671f1710f..4172bbd23340 100644
> --- a/target/i386/kvm/tdx.c
> +++ b/target/i386/kvm/tdx.c
> @@ -1026,7 +1026,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);
> @@ -1039,7 +1041,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);
> @@ -1052,7 +1056,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);
next prev parent reply other threads:[~2025-06-03 9:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 5:03 [PATCH 0/3] TDX: Fix and enhancement Xiaoyao Li
2025-06-03 5:03 ` [PATCH 1/3] i386/cpu: Rename enable_cpuid_0x1f to force_cpuid_0x1f Xiaoyao Li
2025-06-03 8:31 ` Daniel P. Berrangé
2025-06-03 9:22 ` Igor Mammedov
2025-06-04 10:35 ` Zhao Liu
2025-06-03 5:03 ` [PATCH 2/3] i386/tdx: Fix the typo of the comment of struct TdxGuest Xiaoyao Li
2025-06-03 8:30 ` Daniel P. Berrangé
2025-06-03 9:24 ` Igor Mammedov
2025-06-04 10:36 ` Zhao Liu
2025-06-03 5:03 ` [PATCH 3/3] i386/tdx: Clarify the error message of mrconfigid/mrowner/mrownerconfig Xiaoyao Li
2025-06-03 8:30 ` Daniel P. Berrangé
2025-06-03 9:27 ` Igor Mammedov [this message]
2025-06-04 10:38 ` Zhao Liu
2025-06-17 18:02 ` [PATCH 0/3] TDX: Fix and enhancement Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250603112705.58ca139a@imammedo.users.ipa.redhat.com \
--to=imammedo@redhat.com \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=xiaoyao.li@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).