Re: [PATCH v2 07/17] KVM: x86/mmu: Check PDPTRs before allocating PAE roots

2021-04-08 Thread Paolo Bonzini
On 08/04/21 18:27, Sean Christopherson wrote: For your approach, can we put the out label after the success path? Setting mmu->root_pgd isn't wrong per se, but doing so might mislead future readers into thinking that it's functionally necessary. Indeed, thanks for the speedy review. I'll get

Re: [PATCH v2 07/17] KVM: x86/mmu: Check PDPTRs before allocating PAE roots

2021-04-08 Thread Sean Christopherson
On Thu, Apr 08, 2021, Paolo Bonzini wrote: > On 08/04/21 17:48, Sean Christopherson wrote: > > Freaking PDPTRs. I was really hoping we could keep the lock and > > pages_available() > > logic outside of the helpers. What if kvm_mmu_load() reads the PDPTRs and > > passes them into

Re: [PATCH v2 07/17] KVM: x86/mmu: Check PDPTRs before allocating PAE roots

2021-04-08 Thread Paolo Bonzini
On 08/04/21 17:48, Sean Christopherson wrote: Freaking PDPTRs. I was really hoping we could keep the lock and pages_available() logic outside of the helpers. What if kvm_mmu_load() reads the PDPTRs and passes them into mmu_alloc_shadow_roots()? Or is that too ugly? The patch I have posted

Re: [PATCH v2 07/17] KVM: x86/mmu: Check PDPTRs before allocating PAE roots

2021-04-08 Thread Sean Christopherson
On Thu, Apr 08, 2021, Paolo Bonzini wrote: > On 08/04/21 13:15, Wanpeng Li wrote: > > I saw this splatting: > > > > BUG: sleeping function called from invalid context at > > arch/x86/kvm/kvm_cache_regs.h:115 > >kvm_pdptr_read+0x20/0x60 [kvm] > >kvm_mmu_load+0x3bd/0x540 [kvm] > > > >

Re: [PATCH v2 07/17] KVM: x86/mmu: Check PDPTRs before allocating PAE roots

2021-04-08 Thread Paolo Bonzini
On 08/04/21 13:15, Wanpeng Li wrote: I saw this splatting: BUG: sleeping function called from invalid context at arch/x86/kvm/kvm_cache_regs.h:115 kvm_pdptr_read+0x20/0x60 [kvm] kvm_mmu_load+0x3bd/0x540 [kvm] There is a might_sleep() in kvm_pdptr_read(), however, the original commit

Re: [PATCH v2 07/17] KVM: x86/mmu: Check PDPTRs before allocating PAE roots

2021-04-08 Thread Wanpeng Li
On Fri, 5 Mar 2021 at 09:12, Sean Christopherson wrote: > > Check the validity of the PDPTRs before allocating any of the PAE roots, > otherwise a bad PDPTR will cause KVM to leak any previously allocated > roots. > > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/mmu/mmu.c | 20

[PATCH v2 07/17] KVM: x86/mmu: Check PDPTRs before allocating PAE roots

2021-03-04 Thread Sean Christopherson
Check the validity of the PDPTRs before allocating any of the PAE roots, otherwise a bad PDPTR will cause KVM to leak any previously allocated roots. Signed-off-by: Sean Christopherson --- arch/x86/kvm/mmu/mmu.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff