Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-11-02 Thread Wanpeng Li
Hi Paolo, On 14/11/2 下午2:50, Paolo Bonzini wrote: On 01/11/2014 03:49, Wanpeng Li wrote: This is also not enough. I see the warning in the below path during the test: kvm_arch_vcpu_ioctl_run -> kvm_apic_accept_events -> kvm_vcpu_reset Hmm, better bypass the problem altogether: diff --git a/a

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-11-01 Thread Paolo Bonzini
On 01/11/2014 03:49, Wanpeng Li wrote: > > This is also not enough. I see the warning in the below path during the > test: > > kvm_arch_vcpu_ioctl_run > -> kvm_apic_accept_events > -> kvm_vcpu_reset Hmm, better bypass the problem altogether: diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Wanpeng Li
Hi Paolo, On 14/10/31 下午6:36, Paolo Bonzini wrote: On 31/10/2014 06:30, Chen, Tiejun wrote: @@ -4442,6 +4442,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); struct msr_data apic_base_msr; + int idx; vmx->rmode.vm8

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Wanpeng Li
Hi Paolo, On 14/10/31 下午6:36, Paolo Bonzini wrote: On 31/10/2014 06:30, Chen, Tiejun wrote: @@ -4442,6 +4442,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); struct msr_data apic_base_msr; + int idx; vmx->rmode.vm8

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-31 Thread Paolo Bonzini
On 31/10/2014 06:30, Chen, Tiejun wrote: > > @@ -4442,6 +4442,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) > { > struct vcpu_vmx *vmx = to_vmx(vcpu); > struct msr_data apic_base_msr; > + int idx; > > vmx->rmode.vm86_active = 0; > > @@ -4509,7 +4510,9 @@

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-30 Thread Wanpeng Li
Hi Tiejun, On Fri, Oct 31, 2014 at 01:30:35PM +0800, Chen, Tiejun wrote: >On 2014/10/31 12:33, Wanpeng Li wrote: >>The srcu read lock must be held while accessing memslots (e.g. >>when using gfn_to_* functions), however, commit c24ae0dcd3e8 >>("kvm: x86: Unpin and remove kvm_arch->apic_access_page"

Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-30 Thread Chen, Tiejun
On 2014/10/31 12:33, Wanpeng Li wrote: The srcu read lock must be held while accessing memslots (e.g. when using gfn_to_* functions), however, commit c24ae0dcd3e8 ("kvm: x86: Unpin and remove kvm_arch->apic_access_page") call gfn_to_page() in kvm_vcpu_reload_apic_access_page() w/o hold it which l

[PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

2014-10-30 Thread Wanpeng Li
The srcu read lock must be held while accessing memslots (e.g. when using gfn_to_* functions), however, commit c24ae0dcd3e8 ("kvm: x86: Unpin and remove kvm_arch->apic_access_page") call gfn_to_page() in kvm_vcpu_reload_apic_access_page() w/o hold it which leads to suspicious rcu_dereference_che