[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] nestedsvm: fix VMEXIT emulation



At 11:08 +0200 on 17 Oct (1350472115), Christoph Egger wrote:
> 
> Values in regs can be newer than those in the shadow
> vmcb (e.g. due to an instruction emulation right before).
> So use the values from regs.
> 
> Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>

Acked-by: Tim Deegan <tim@xxxxxxx>


Content-Description: xen_nh_vmexit.diff
> diff -r 6b73078a4403 xen/arch/x86/hvm/svm/nestedsvm.c
> --- a/xen/arch/x86/hvm/svm/nestedsvm.c        Fri Oct 12 14:38:20 2012 +0200
> +++ b/xen/arch/x86/hvm/svm/nestedsvm.c        Wed Oct 17 09:19:05 2012 +0200
> @@ -990,7 +999,7 @@ nsvm_vmcb_guest_intercepts_trap(struct v
>  }
>  
>  static int
> -nsvm_vmcb_prepare4vmexit(struct vcpu *v)
> +nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
>  {
>      struct nestedvcpu *nv = &vcpu_nestedhvm(v);
>      struct nestedsvm *svm = &vcpu_nestedsvm(v);
> @@ -1114,17 +1123,22 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v)
>      ns_vmcb->_dr7 = n2vmcb->_dr7;
>      ns_vmcb->_dr6 = n2vmcb->_dr6;
>  
> +    /* Restore registers from regs as those values
> +     * can be newer than in n2vmcb (e.g. due to an
> +     * instruction emulation right before).
> +     */
> +
>      /* RFLAGS */
> -    ns_vmcb->rflags = n2vmcb->rflags;
> +    ns_vmcb->rflags = n2vmcb->rflags = regs->rflags;
>  
>      /* RIP */
> -    ns_vmcb->rip = n2vmcb->rip;
> +    ns_vmcb->rip = n2vmcb->rip = regs->rip;
>  
>      /* RSP */
> -    ns_vmcb->rsp = n2vmcb->rsp;
> +    ns_vmcb->rsp = n2vmcb->rsp = regs->rsp;
>  
>      /* RAX */
> -    ns_vmcb->rax = n2vmcb->rax;
> +    ns_vmcb->rax = n2vmcb->rax = regs->rax;
>  
>      /* Keep the l2 guest values of the fs, gs, ldtr, tr, kerngsbase,
>       * star, lstar, cstar, sfmask, sysenter_cs, sysenter_esp,
> @@ -1358,7 +1372,7 @@ nestedsvm_vmexit_n2n1(struct vcpu *v, st
>      ASSERT(vcpu_nestedhvm(v).nv_vmswitch_in_progress);
>      ASSERT(nestedhvm_vcpu_in_guestmode(v));
>  
> -    rc = nsvm_vmcb_prepare4vmexit(v);
> +    rc = nsvm_vmcb_prepare4vmexit(v, regs);
>      if (rc)
>          ret = NESTEDHVM_VMEXIT_ERROR;
>  

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.