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 xiaoguangr...@linux.vnet.ibm.com wrote: On 08/06/2014 06:39 AM, David Matlack wrote: On Mon, Aug 4, 2014 at 8:36 PM, Xiao Guangrong xiaoguangr...@linux.vnet.ibm.com wrote: The memory barrier can't help us, consider this scenario: CPU 0

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 wanpeng...@linux.intel.com 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

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 xiaoguangr...@linux.vnet.ibm.com 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

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 xiaoguangr...@linux.vnet.ibm.com 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

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

2014-08-04 Thread David Matlack
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-execute-noread so that future accesses cause

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 sets

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