Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-29 Thread Sean Christopherson
On Fri, May 29, 2020 at 09:46:13AM +0200, Vitaly Kuznetsov wrote: > Sean Christopherson writes: > > > I'll looking into writing a script to run all selftests with a single > > command, unless someone already has one laying around? > > Is 'make run_tests' in tools/testing/selftests/kvm/ what you

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-29 Thread Vitaly Kuznetsov
Sean Christopherson writes: > I'll looking into writing a script to run all selftests with a single > command, unless someone already has one laying around? Is 'make run_tests' in tools/testing/selftests/kvm/ what you're looking for? -- Vitaly

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-28 Thread Sean Christopherson
On Wed, May 27, 2020 at 09:29:33AM -0700, Sean Christopherson wrote: > On Wed, May 27, 2020 at 06:17:57PM +0200, Paolo Bonzini wrote: > > On 27/05/20 10:54, Sean Christopherson wrote: > > > Initialize vcpu->arch.tdp_level during vCPU creation to avoid consuming > > > garbage if userspace calls KVM_

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Sean Christopherson
On Wed, May 27, 2020 at 06:56:02PM +0200, Paolo Bonzini wrote: > On 27/05/20 18:23, Sean Christopherson wrote: > > Hmm, one option would be to make .get_tdp_level() pure function by passing > > in vcpu->arch.maxphyaddr. That should make the comment redundant. I don't > > love bleeding VMX's imple

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Sean Christopherson
On Wed, May 27, 2020 at 06:56:19PM +0200, Paolo Bonzini wrote: > On 27/05/20 18:29, Sean Christopherson wrote: > > Ya. syzbot is hitting a #GP due to NULL pointer during debugfs on the exact > > same sequence. I haven't been able to reproduce that one (have yet to try > > syzbot's exact config),

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Paolo Bonzini
On 27/05/20 18:29, Sean Christopherson wrote: > On Wed, May 27, 2020 at 06:17:57PM +0200, Paolo Bonzini wrote: >> On 27/05/20 10:54, Sean Christopherson wrote: >>> Initialize vcpu->arch.tdp_level during vCPU creation to avoid consuming >>> garbage if userspace calls KVM_RUN without first calling KV

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Paolo Bonzini
On 27/05/20 18:23, Sean Christopherson wrote: > Hmm, one option would be to make .get_tdp_level() pure function by passing > in vcpu->arch.maxphyaddr. That should make the comment redundant. I don't > love bleeding VMX's implementation into the prototype, but that ship has > kinda already sailed.

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Sean Christopherson
On Wed, May 27, 2020 at 06:17:57PM +0200, Paolo Bonzini wrote: > On 27/05/20 10:54, Sean Christopherson wrote: > > 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:

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Sean Christopherson
On Wed, May 27, 2020 at 06:15:27PM +0200, Paolo Bonzini wrote: > On 27/05/20 12:03, Vitaly Kuznetsov wrote: > >> > >>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; >

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Paolo Bonzini
On 27/05/20 10:54, Sean Christopherson wrote: > 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+9

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Paolo Bonzini
On 27/05/20 12:03, Vitaly Kuznetsov wrote: >> >> 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; > Reviewed-by: Vitaly Kuznetsov > > Looking at kvm_update_cpuid() I

Re: [PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Vitaly Kuznetsov
Sean Christopherson writes: > 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+904752567107eefb7.

[PATCH] KVM: x86: Initialize tdp_level during vCPU creation

2020-05-27 Thread Sean Christopherson
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+904752567107eefb7...@syzkaller.appspotmail.com Signed-off