lkml.org 
[lkml]   [2014]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock


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 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu)
> vmcs_write32(TPR_THRESHOLD, 0);
> }
>
> + idx = srcu_read_lock(&vcpu->kvm->srcu);
> kvm_vcpu_reload_apic_access_page(vcpu);
> + srcu_read_unlock(&vcpu->kvm->srcu, idx);
>
> if (vmx_vm_has_apicv(vcpu->kvm))
> memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));

Not enough; you can call vcpu_enter_guest -> kvm_apic_accept_events ->
kvm_vcpu_reset -> vmx_vcpu_reset while under the SRCU lock. The right
place to add the lock is kvm_arch_vcpu_setup.

Thanks,

Paolo


\
 
 \ /
  Last update: 2014-10-31 12:21    [W:0.110 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site