From: "Jan Beulich" Subject: Re: [PATCH] Paging and memory sharing for HVM guests Date: Mon, 04 Jan 2010 14:14:01 +0000 Message-ID: <4B4205B90200007800028173@vpn.id2.novell.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Grzegorz Milos , Patrick Colp , Andrew Peace , Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >>> Grzegorz Milos 17.12.09 00:14 >>> One more issue I see with these changes: >--- a/drivers/xen/privcmd/privcmd.c >+++ b/drivers/xen/privcmd/privcmd.c >... >@@ -236,8 +237,14 @@ static long privcmd_ioctl(struct file *f > (m.addr !=3D vma->vm_start) || > ((m.addr + (nr_pages << PAGE_SHIFT)) !=3D vma->vm_end) = || > !privcmd_enforce_singleshot_mapping(vma)) { >- up_write(&mm->mmap_sem); >- goto mmapbatch_out; >+ if (!(vma && >+ (m.addr >=3D vma->vm_start) && >+ ((m.addr + (nr_pages << PAGE_SHIFT)) <=3D = vma->vm_end) && >+ (nr_pages =3D=3D 1) && >+ !privcmd_enforce_singleshot_mapping(vma))) { >+ up_write(&mm->mmap_sem); >+ goto mmapbatch_out; >+ } > } >=20 > p =3D m.arr; Isn't this undermining the purpose of privcmd_enforce_singleshot_mapping()?= You don't check that the eventual single page re-mapping attempt is really due to an earlier -ENOENT failure, and hence the whole single shot mapping checks are now pointless (though other than possibly to enforce some minimal security I don't really know what its purpose is/was - Keir?). Jan