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

Re: [Xen-devel] [PATCH] privcmd: return value of IOCTL_PRIVCMD_MMAPBATCH


  • To: Kouya Shimura <kouya@xxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
  • Date: Thu, 21 Feb 2008 11:39:13 +0000
  • Delivery-date: Thu, 21 Feb 2008 03:39:53 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: Ach0fmF3oAv4+OBxEdyH3gAX8io7RQ==
  • Thread-topic: [Xen-devel] [PATCH] privcmd: return value of IOCTL_PRIVCMD_MMAPBATCH

There's a helper function in libxc to do this. We can't change the privcmd
interface (although we could add a new command).

 -- Keir

On 21/2/08 11:36, "Kouya Shimura" <kouya@xxxxxxxxxxxxxx> wrote:

> Return value of IOCTL_PRIVCMD_MMAPBATCH is always 0
> even if some entries are failed to map.
> 
> IMHO, ioctl should return any failure code.
> It becomes a hotbed of bug.
> 
> Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
> 
> diff -r 65a419f81336 drivers/xen/privcmd/privcmd.c
> --- a/drivers/xen/privcmd/privcmd.c Tue Feb 19 11:22:24 2008 -0700
> +++ b/drivers/xen/privcmd/privcmd.c Thu Feb 21 20:01:32 2008 +0900
> @@ -164,7 +164,7 @@ static long privcmd_ioctl(struct file *f
> struct vm_area_struct *vma;
> xen_pfn_t __user *p;
> unsigned long addr, mfn, nr_pages;
> -  int i;
> +  int i, rc;
>  
> if (!is_initial_xendomain())
> return -EPERM;
> @@ -187,6 +187,7 @@ static long privcmd_ioctl(struct file *f
> return -EINVAL;
> }
>  
> +  ret = 0;
> p = m.arr;
> addr = m.addr;
> for (i = 0; i < nr_pages; i++, addr += PAGE_SIZE, p++) {
> @@ -195,15 +196,16 @@ static long privcmd_ioctl(struct file *f
> return -EFAULT;
> }
>  
> -   ret = direct_remap_pfn_range(vma, addr & PAGE_MASK,
> +   rc = direct_remap_pfn_range(vma, addr & PAGE_MASK,
>     mfn, PAGE_SIZE,
>     vma->vm_page_prot, m.dom);
> -   if (ret < 0)
> -    put_user(0xF0000000 | mfn, p);
> +   if (rc < 0) {
> +    put_user(~(-1UL>>4) | mfn, p);
> +    ret = rc;
> +   }
> }
>  
> up_write(&mm->mmap_sem);
> -  ret = 0;
> }
> break;
>  
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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