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

Re: [Xen-devel] [PATCH 15/18] PVH xen: add hypercall support for PVH



>>> On 25.06.13 at 02:01, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> wrote:
>  int hvm_do_hypercall(struct cpu_user_regs *regs)
>  {
>      struct vcpu *curr = current;
>      struct segment_register sreg;
>      int mode = hvm_guest_x86_mode(curr);
>      uint32_t eax = regs->eax;
> +    hvm_hypercall_t **hcall_table;

If you properly cont-qualified this, ...

> @@ -3348,17 +3379,24 @@ int hvm_do_hypercall(struct cpu_user_regs *regs)
>                      eax, regs->rdi, regs->rsi, regs->rdx,
>                      regs->r10, regs->r8, regs->r9);
>  
> +        if ( is_pvh_vcpu(curr) )
> +            hcall_table = (hvm_hypercall_t **)pvh_hypercall64_table;
> +        else
> +            hcall_table = (hvm_hypercall_t **)hvm_hypercall64_table;

... you wouldn't need these dangerous casts.

> @@ -3777,7 +3815,7 @@ long do_hvm_op(unsigned long op, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>              return -ESRCH;
>  
>          rc = -EINVAL;
> -        if ( !is_hvm_domain(d) )
> +        if ( is_pv_domain(d) )
>              goto param_fail;
>  
>          rc = xsm_hvm_param(XSM_TARGET, d, op);
> @@ -3949,7 +3987,7 @@ long do_hvm_op(unsigned long op, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>                  break;
>              }
>  
> -            if ( rc == 0 ) 
> +            if ( rc == 0 && !is_pvh_domain(d) )
>              {
>                  d->arch.hvm_domain.params[a.index] = a.value;
>  

This last check I think you do because params[] points nowhere for
PVH guests. If so - why don't you just drop this and the earlier
hunk? Or otherwise some of the case statements between need to
also guard against accessing the unset pointer.

Jan


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