Re: [RFC PATCH v2 12/18] KVM: TDX: Bug the VM if extended the initial measurement fails

From: Sean Christopherson
Date: Fri Aug 29 2025 - 19:18:25 EST


On Fri, Aug 29, 2025, Rick P Edgecombe wrote:
> On Fri, 2025-08-29 at 15:39 -0700, Rick Edgecombe wrote:
> > Ok, the direction seem clear. The patch has an issue, need to debug.
>
> Just this:
>
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index c595d9cb6dcd..e99d07611393 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -2809,7 +2809,7 @@ static int tdx_td_finalize(struct kvm *kvm, struct
> kvm_tdx_cmd *cmd)
>
> static int tdx_get_cmd(void __user *argp, struct kvm_tdx_cmd *cmd)
> {
> - if (copy_from_user(cmd, argp, sizeof(cmd)))
> + if (copy_from_user(cmd, argp, sizeof(*cmd)))

LOL, it's always some mundane detail!

> return -EFAULT;
>
> if (cmd->hw_error)
>