lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 01 Nov 2014 10:49:41 +0800
From:	Wanpeng Li <kernellwp@...il.com>
To:	Paolo Bonzini <pbonzini@...hat.com>,
	"Chen, Tiejun" <tiejun.chen@...el.com>,
	Wanpeng Li <wanpeng.li@...ux.intel.com>
CC:	Gleb Natapov <gleb@...nel.org>,
	Alexei Starovoitov <alexei.starovoitov@...il.com>,
	Takashi Iwai <tiwai@...e.de>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: fix access memslots w/o hold srcu read lock

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

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

I just send out the version 3 and hope it can take care all the 
situations. ;-)

Regards,
Wanpeng Li

>
> Thanks,
>
> Paolo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists