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:	Mon, 06 Sep 2010 21:17:53 +0300
From:	Avi Kivity <avi@...hat.com>
To:	Joerg Roedel <joerg.roedel@....com>
CC:	Marcelo Tosatti <mtosatti@...hat.com>,
	Alexander Graf <agraf@...e.de>, joro@...tes.org,
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 17/27] KVM: MMU: Track page fault data in struct vcpu

  On 09/06/2010 06:55 PM, Joerg Roedel wrote:
> This patch introduces a struct with two new fields in
> vcpu_arch for x86:
>
> 	* fault.address
> 	* fault.error_code
>
> This will be used to correctly propagate page faults back
> into the guest when we could have either an ordinary page
> fault or a nested page fault. In the case of a nested page
> fault the fault-address is different from the original
> address that should be walked. So we need to keep track
> about the real fault-address.
>
>
>
> -static void emulate_pf(struct x86_emulate_ctxt *ctxt, unsigned long addr,
> -		       int err)
> +static void emulate_pf(struct x86_emulate_ctxt *ctxt)
>   {
> -	ctxt->cr2 = addr;
> -	emulate_exception(ctxt, PF_VECTOR, err, true);
> +	emulate_exception(ctxt, PF_VECTOR, 0, true);
>   }

What happened to the error code?

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index b2fe9e7..38d482d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4130,7 +4130,8 @@ static void inject_emulated_exception(struct kvm_vcpu *vcpu)
>   {
>   	struct x86_emulate_ctxt *ctxt =&vcpu->arch.emulate_ctxt;
>   	if (ctxt->exception == PF_VECTOR)
> -		kvm_inject_page_fault(vcpu, ctxt->cr2, ctxt->error_code);
> +		kvm_inject_page_fault(vcpu, vcpu->arch.fault.address,
> +					    vcpu->arch.fault.error_code);
>   	else if (ctxt->error_code_valid)
>   		kvm_queue_exception_e(vcpu, ctxt->exception, ctxt->error_code);
>   	else

Ah.  Not lovely, but it was ugly before as well.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

--
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