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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 7 Sep 2010 15:43:16 -0300
From:	Marcelo Tosatti <mtosatti@...hat.com>
To:	Joerg Roedel <joerg.roedel@....com>
Cc:	Avi Kivity <avi@...hat.com>, Alexander Graf <agraf@...e.de>,
	joro@...tes.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 19/27] KVM: X86: Propagate fetch faults

On Mon, Sep 06, 2010 at 05:55:58PM +0200, Joerg Roedel wrote:
> KVM currently ignores fetch faults in the instruction
> emulator. With nested-npt we could have such faults. This
> patch adds the code to handle these.
> 
> Signed-off-by: Joerg Roedel <joerg.roedel@....com>
> ---
>  arch/x86/kvm/emulate.c |    3 +++
>  arch/x86/kvm/x86.c     |    4 ++++
>  2 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 2b08b78..aead72e 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -1198,6 +1198,9 @@ static int emulate_popf(struct x86_emulate_ctxt *ctxt,
>  	*(unsigned long *)dest =
>  		(ctxt->eflags & ~change_mask) | (val & change_mask);
>  
> +	if (rc == X86EMUL_PROPAGATE_FAULT)
> +		emulate_pf(ctxt);
> +
>  	return rc;
>  }
>  
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 65b00f0..ca69dcc 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4237,6 +4237,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
>  		vcpu->arch.emulate_ctxt.perm_ok = false;
>  
>  		r = x86_decode_insn(&vcpu->arch.emulate_ctxt);
> +		if (r == X86EMUL_PROPAGATE_FAULT)
> +			goto done;
> +

x86_decode_insn returns -1 / 0 ? 

>  		trace_kvm_emulate_insn_start(vcpu);
>  
>  		/* Only allow emulation of specific instructions on #UD
> @@ -4295,6 +4298,7 @@ restart:
>  		return handle_emulation_failure(vcpu);
>  	}
>  
> +done:
>  	if (vcpu->arch.emulate_ctxt.exception >= 0) {
>  		inject_emulated_exception(vcpu);
>  		r = EMULATE_DONE;
> -- 
> 1.7.0.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ