Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-06 Thread David Matlack
On Tue, Aug 5, 2014 at 8:26 PM, Xiao Guangrong wrote: > On 08/06/2014 06:39 AM, David Matlack wrote: >> On Mon, Aug 4, 2014 at 8:36 PM, Xiao Guangrong >> wrote: >>> The memory barrier can't help us, consider this scenario: >>> >>> CPU 0 CPU 1 >>> page-fault >>

Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-05 Thread Xiao Guangrong
On 08/06/2014 06:39 AM, David Matlack wrote: > On Mon, Aug 4, 2014 at 8:36 PM, Xiao Guangrong > wrote: >> On 08/05/2014 05:10 AM, David Matlack wrote: >>> >>> This patch fixes the issue by doing the following: >>> - Tag the mmio cache with the memslot generation and use it to >>> validate mm

Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-05 Thread David Matlack
On Mon, Aug 4, 2014 at 8:36 PM, Xiao Guangrong wrote: > On 08/05/2014 05:10 AM, David Matlack wrote: >> >> This patch fixes the issue by doing the following: >> - Tag the mmio cache with the memslot generation and use it to >> validate mmio cache lookups. >> - Extend vcpu_clear_mmio_info t

Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-05 Thread David Matlack
On Mon, Aug 4, 2014 at 5:31 PM, Wanpeng Li wrote: > Hi David, > On Mon, Aug 04, 2014 at 02:10:20PM -0700, David Matlack wrote: >>The following events can lead to an incorrect KVM_EXIT_MMIO bubbling >>up to userspace: >> >>(1) Guest accesses gpa X without a memory slot. The gfn is cached in >>struc

Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-04 Thread Xiao Guangrong
On 08/05/2014 05:10 AM, David Matlack wrote: > The following events can lead to an incorrect KVM_EXIT_MMIO bubbling > up to userspace: > > (1) Guest accesses gpa X without a memory slot. The gfn is cached in > struct kvm_vcpu_arch (mmio_gfn). On Intel EPT-enabled hosts, KVM sets > the SPTE write-e

Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-04 Thread Wanpeng Li
Hi David, On Mon, Aug 04, 2014 at 02:10:20PM -0700, David Matlack wrote: >The following events can lead to an incorrect KVM_EXIT_MMIO bubbling >up to userspace: > >(1) Guest accesses gpa X without a memory slot. The gfn is cached in >struct kvm_vcpu_arch (mmio_gfn). On Intel EPT-enabled hosts, KVM