WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Kouya Shimura <kouya@xxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] privcmd: return value of IOCTL_PRIVCMD_MMAPBATCH
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <7kk5kytubh.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Ach0fmF3oAv4+OBxEdyH3gAX8io7RQ==
Thread-topic: [Xen-devel] [PATCH] privcmd: return value of IOCTL_PRIVCMD_MMAPBATCH
User-agent: Microsoft-Entourage/11.3.6.070618
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

<Prev in Thread] Current Thread [Next in Thread>