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]
Message-Id: <5D23F679-9E64-4BFA-8041-C18952EF0F56@oracle.com>
Date:   Fri, 23 Aug 2019 16:23:38 +0300
From:   Liran Alon <liran.alon@...cle.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Radim Krčmář <rkrcmar@...hat.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH 05/13] KVM: x86: Don't attempt VMWare emulation on
 #GP with non-zero error code



> On 23 Aug 2019, at 4:07, Sean Christopherson <sean.j.christopherson@...el.com> wrote:
> 
> The VMware backdoor hooks #GP faults on IN{S}, OUT{S}, and RDPMC, none
> of which generate a non-zero error code for their #GP.  Re-injecting #GP
> instead of attempting emulation on a non-zero error code will allow a
> future patch to move #GP injection (for emulation failure) into
> kvm_emulate_instruction() without having to plumb in the error code.
> 
> Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>

Reviewed-by: Liran Alon <liran.alon@...cle.com>

-Liran

> ---
> arch/x86/kvm/svm.c     | 6 +++++-
> arch/x86/kvm/vmx/vmx.c | 7 ++++++-
> 2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 5a42f9c70014..b96a119690f4 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -2772,11 +2772,15 @@ static int gp_interception(struct vcpu_svm *svm)
> 
> 	WARN_ON_ONCE(!enable_vmware_backdoor);
> 
> +	if (error_code) {
> +		kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
> +		return 1;
> +	}
> 	er = kvm_emulate_instruction(vcpu, EMULTYPE_VMWARE);
> 	if (er == EMULATE_USER_EXIT)
> 		return 0;
> 	else if (er != EMULATE_DONE)
> -		kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
> +		kvm_queue_exception_e(vcpu, GP_VECTOR, 0);
> 	return 1;
> }
> 
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 6ecf773825e2..3ee0dd304bc7 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -4509,11 +4509,16 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
> 
> 	if (!vmx->rmode.vm86_active && is_gp_fault(intr_info)) {
> 		WARN_ON_ONCE(!enable_vmware_backdoor);
> +
> +		if (error_code) {
> +			kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
> +			return 1;
> +		}
> 		er = kvm_emulate_instruction(vcpu, EMULTYPE_VMWARE);
> 		if (er == EMULATE_USER_EXIT)
> 			return 0;
> 		else if (er != EMULATE_DONE)
> -			kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
> +			kvm_queue_exception_e(vcpu, GP_VECTOR, 0);
> 		return 1;
> 	}
> 
> -- 
> 2.22.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ