linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Initialize tdp_level during vCPU creation
@ 2020-05-27  8:54 Sean Christopherson
  2020-05-27 10:03 ` Vitaly Kuznetsov
  2020-05-27 16:17 ` Paolo Bonzini
  0 siblings, 2 replies; 13+ messages in thread
From: Sean Christopherson @ 2020-05-27  8:54 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel, syzbot+904752567107eefb728c

Initialize vcpu->arch.tdp_level during vCPU creation to avoid consuming
garbage if userspace calls KVM_RUN without first calling KVM_SET_CPUID.

Fixes: e93fd3b3e89e9 ("KVM: x86/mmu: Capture TDP level when updating CPUID")
Reported-by: syzbot+904752567107eefb728c@syzkaller.appspotmail.com
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b226fb8abe41b..01a6304056197 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -9414,6 +9414,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
 	fx_init(vcpu);
 
 	vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
+	vcpu->arch.tdp_level = kvm_x86_ops.get_tdp_level(vcpu);
 
 	vcpu->arch.pat = MSR_IA32_CR_PAT_DEFAULT;
 
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-05-29 13:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27  8:54 [PATCH] KVM: x86: Initialize tdp_level during vCPU creation Sean Christopherson
2020-05-27 10:03 ` Vitaly Kuznetsov
2020-05-27 16:15   ` Paolo Bonzini
2020-05-27 16:23     ` Sean Christopherson
2020-05-27 16:56       ` Paolo Bonzini
2020-05-28  2:27         ` Sean Christopherson
2020-05-27 16:17 ` Paolo Bonzini
2020-05-27 16:29   ` Sean Christopherson
2020-05-27 16:56     ` Paolo Bonzini
2020-05-27 17:06       ` Sean Christopherson
2020-05-28 19:46     ` Sean Christopherson
2020-05-29  7:46       ` Vitaly Kuznetsov
2020-05-29 13:06         ` Sean Christopherson

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).