[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d4a77196b446e2fe0ee930a45888fae4cb60a5b.camel@intel.com>
Date: Tue, 15 Jul 2025 21:01:42 +0000
From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>
To: "pbonzini@...hat.com" <pbonzini@...hat.com>, "seanjc@...gle.com"
<seanjc@...gle.com>
CC: "Li, Xiaoyao" <xiaoyao.li@...el.com>, "kvm@...r.kernel.org"
<kvm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] KVM: VMX: Ensure unused kvm_tdx_capabilities fields are
zeroed out
On Mon, 2025-07-14 at 15:19 -0700, Sean Christopherson wrote:
> Zero-allocate the kernel's kvm_tdx_capabilities structure and copy only
> the number of CPUID entries from the userspace structure. As is, KVM
> doesn't ensure kernel_tdvmcallinfo_1_{r11,r12} and user_tdvmcallinfo_1_r12
> are zeroed, i.e. KVM will reflect whatever happens to be in the userspace
> structure back at usersepace, and thus may report garbage to userspace.
^typo
>
> Zeroing the entire kernel structure also provides better semantics for the
> reserved field. E.g. if KVM extends kvm_tdx_capabilities to enumerate new
> information by repurposing bytes from the reserved field, userspace would
> be required to zero the new field in order to get useful information back
> (because older KVMs without support for the repurposed field would report
> garbage, a la the aforementioned tdvmcallinfo bugs).
>
> Fixes: 61bb28279623 ("KVM: TDX: Get system-wide info about TDX module on initialization")
> Suggested-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Reported-by: Xiaoyao Li <xiaoyao.li@...el.com>
> Closes: https://lore.kernel.org/all/3ef581f1-1ff1-4b99-b216-b316f6415318@intel.com
> Tested-by: Xiaoyao Li <xiaoyao.li@...el.com>
> Reviewed-by: Xiaoyao Li <xiaoyao.li@...el.com>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Thanks Sean!
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
Powered by blists - more mailing lists