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

Re: [Xen-devel] [PATCH 3/4] x86/SVM: don't exceed segment limit when fetching instruction bytes



On 10/11/15 17:40, Jan Beulich wrote:
> Also consistently use the vmcb local variable whenever possible.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> with one trivial fix.

>
> --- a/xen/arch/x86/hvm/svm/emulate.c
> +++ b/xen/arch/x86/hvm/svm/emulate.c
> @@ -47,12 +47,17 @@ static unsigned int is_prefix(u8 opc)
>      return 0;
>  }
>  
> -static unsigned long svm_rip2pointer(struct vcpu *v)
> +static unsigned long svm_rip2pointer(struct vcpu *v, unsigned long *limit)
>  {
>      struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
> -    unsigned long p = vmcb->cs.base + guest_cpu_user_regs()->eip;
> +    unsigned long p = vmcb->cs.base + vmcb->rip;
> +
>      if ( !(vmcb->cs.attr.fields.l && hvm_long_mode_enabled(v)) )
> +    {
> +        *limit = vmcb->cs.limit;
>          return (u32)p; /* mask to 32 bits */
> +    }
> +    *limit = ~0UL;
>      return p;
>  }
>  
> @@ -125,11 +130,10 @@ static const u8 *const opc_bytes[INSTR_M
>      [INSTR_INVLPGA] = OPCODE_INVLPGA,
>  };
>  
> -static int fetch(struct vcpu *v, u8 *buf, unsigned long addr, int len)
> +static bool_t fetch(const struct vmcb_struct *vmcb, u8 *buf,
> +                   unsigned long addr, unsigned int len)

(mis)indentation of addr

~Andrew

_______________________________________________
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®.