KVM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] KVM: nVMX: vmread should not set rflags to specify success in case of #PF
@ 2019-12-28  6:25 linmiaohe
  2020-01-13 20:09 ` Sean Christopherson
  2020-01-15 18:18 ` Paolo Bonzini
  0 siblings, 2 replies; 5+ messages in thread
From: linmiaohe @ 2019-12-28  6:25 UTC (permalink / raw)
  To: pbonzini, rkrcmar, sean.j.christopherson, vkuznets, wanpengli,
	jmattson, joro, tglx, mingo, bp, hpa
  Cc: linmiaohe, liran.alon, kvm, linux-kernel, x86

From: Miaohe Lin <linmiaohe@huawei.com>

In case writing to vmread destination operand result in a #PF, vmread
should not call nested_vmx_succeed() to set rflags to specify success.
Similar to as done in VMPTRST (See handle_vmptrst()).

Reviewed-by: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
v2:
	rephrase commit title & message
---
 arch/x86/kvm/vmx/nested.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 8edefdc9c0cb..c1ec9f25a417 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -4799,8 +4799,10 @@ static int handle_vmread(struct kvm_vcpu *vcpu)
 					instr_info, true, len, &gva))
 			return 1;
 		/* _system ok, nested_vmx_check_permission has verified cpl=0 */
-		if (kvm_write_guest_virt_system(vcpu, gva, &value, len, &e))
+		if (kvm_write_guest_virt_system(vcpu, gva, &value, len, &e)) {
 			kvm_inject_page_fault(vcpu, &e);
+			return 1;
+		}
 	}
 
 	return nested_vmx_succeed(vcpu);
-- 
2.19.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] KVM: nVMX: vmread should not set rflags to specify success in case of #PF
  2019-12-28  6:25 [PATCH v2] KVM: nVMX: vmread should not set rflags to specify success in case of #PF linmiaohe
@ 2020-01-13 20:09 ` Sean Christopherson
  2020-01-13 20:11   ` Sean Christopherson
  2020-01-15 18:18 ` Paolo Bonzini
  1 sibling, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2020-01-13 20:09 UTC (permalink / raw)
  To: linmiaohe
  Cc: pbonzini, rkrcmar, vkuznets, wanpengli, jmattson, joro, tglx,
	mingo, bp, hpa, liran.alon, kvm, linux-kernel, x86

On Sat, Dec 28, 2019 at 02:25:24PM +0800, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> In case writing to vmread destination operand result in a #PF, vmread
> should not call nested_vmx_succeed() to set rflags to specify success.
> Similar to as done in VMPTRST (See handle_vmptrst()).
> 
> Reviewed-by: Liran Alon <liran.alon@oracle.com>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] KVM: nVMX: vmread should not set rflags to specify success in case of #PF
  2020-01-13 20:09 ` Sean Christopherson
@ 2020-01-13 20:11   ` Sean Christopherson
  0 siblings, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2020-01-13 20:11 UTC (permalink / raw)
  To: linmiaohe
  Cc: pbonzini, rkrcmar, vkuznets, wanpengli, jmattson, joro, tglx,
	mingo, bp, hpa, liran.alon, kvm, linux-kernel, x86

On Mon, Jan 13, 2020 at 12:09:42PM -0800, Sean Christopherson wrote:
> On Sat, Dec 28, 2019 at 02:25:24PM +0800, linmiaohe wrote:
> > From: Miaohe Lin <linmiaohe@huawei.com>
> > 
> > In case writing to vmread destination operand result in a #PF, vmread
> > should not call nested_vmx_succeed() to set rflags to specify success.
> > Similar to as done in VMPTRST (See handle_vmptrst()).
> > 
> > Reviewed-by: Liran Alon <liran.alon@oracle.com>
> > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> 
> Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>

Gah, got trigger happy.  This could also have "Cc: stable@vger.kernel.org".
With that, my Reviewed-by stands :-).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] KVM: nVMX: vmread should not set rflags to specify success in case of #PF
  2019-12-28  6:25 [PATCH v2] KVM: nVMX: vmread should not set rflags to specify success in case of #PF linmiaohe
  2020-01-13 20:09 ` Sean Christopherson
@ 2020-01-15 18:18 ` Paolo Bonzini
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2020-01-15 18:18 UTC (permalink / raw)
  To: linmiaohe, rkrcmar, sean.j.christopherson, vkuznets, wanpengli,
	jmattson, joro, tglx, mingo, bp, hpa
  Cc: liran.alon, kvm, linux-kernel, x86

On 28/12/19 07:25, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> In case writing to vmread destination operand result in a #PF, vmread
> should not call nested_vmx_succeed() to set rflags to specify success.
> Similar to as done in VMPTRST (See handle_vmptrst()).
> 
> Reviewed-by: Liran Alon <liran.alon@oracle.com>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> v2:
> 	rephrase commit title & message
> ---
>  arch/x86/kvm/vmx/nested.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 8edefdc9c0cb..c1ec9f25a417 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -4799,8 +4799,10 @@ static int handle_vmread(struct kvm_vcpu *vcpu)
>  					instr_info, true, len, &gva))
>  			return 1;
>  		/* _system ok, nested_vmx_check_permission has verified cpl=0 */
> -		if (kvm_write_guest_virt_system(vcpu, gva, &value, len, &e))
> +		if (kvm_write_guest_virt_system(vcpu, gva, &value, len, &e)) {
>  			kvm_inject_page_fault(vcpu, &e);
> +			return 1;
> +		}
>  	}
>  
>  	return nested_vmx_succeed(vcpu);
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] KVM: nVMX: vmread should not set rflags to specify success in case of #PF
@ 2020-01-14  2:15 linmiaohe
  0 siblings, 0 replies; 5+ messages in thread
From: linmiaohe @ 2020-01-14  2:15 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: pbonzini, rkrcmar, vkuznets, wanpengli, jmattson, joro, tglx,
	mingo, bp, hpa, liran.alon, kvm, linux-kernel, x86

Hi,
On Mon, Jan 13, 2020 at 12:09:42PM -0800, Sean Christopherson wrote:
> > On Sat, Dec 28, 2019 at 02:25:24PM +0800, linmiaohe wrote:
> > > From: Miaohe Lin <linmiaohe@huawei.com>
> > > 
> > > In case writing to vmread destination operand result in a #PF, 
> > vmread should not call nested_vmx_succeed() to set rflags to specify success.
> > > Similar to as done in VMPTRST (See handle_vmptrst()).
> > > 
> > > Reviewed-by: Liran Alon <liran.alon@oracle.com>
> > > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> > 
> > Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
>
> Gah, got trigger happy.  This could also have "Cc: stable@vger.kernel.org".
> With that, my Reviewed-by stands :-).

Many thanks for your review. I would add Cc tag and resend a v3. Thanks again.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-28  6:25 [PATCH v2] KVM: nVMX: vmread should not set rflags to specify success in case of #PF linmiaohe
2020-01-13 20:09 ` Sean Christopherson
2020-01-13 20:11   ` Sean Christopherson
2020-01-15 18:18 ` Paolo Bonzini
2020-01-14  2:15 linmiaohe

KVM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvm/0 kvm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvm kvm/ https://lore.kernel.org/kvm \
		kvm@vger.kernel.org
	public-inbox-index kvm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.kvm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git