From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 2/2] xen/privcmd: add PRIVCMD_MMAPBATCH_V2 ioctl Date: Fri, 31 Aug 2012 08:02:12 +0100 Message-ID: <1346396532.5820.1.camel@dagon.hellion.org.uk> References: <1346331492-15027-1-git-send-email-david.vrabel@citrix.com> <1346331492-15027-3-git-send-email-david.vrabel@citrix.com> <12E7F3C7-86B7-4B6B-8F53-23CCFCEF80FB@gridcentric.ca> <503F9D14.8000600@citrix.com> <165680AD-2970-4A8D-BEC0-B02830F8A97F@gridcentric.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <165680AD-2970-4A8D-BEC0-B02830F8A97F@gridcentric.ca> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andres Lagar-Cavilla Cc: "xen-devel@lists.xensource.com" , David Vrabel , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org On Thu, 2012-08-30 at 19:29 +0100, Andres Lagar-Cavilla wrote: > On Aug 30, 2012, at 1:04 PM, David Vrabel wrote: > > You can't access user space pages here while holding > > current->mm->mmap_sem. I tried this and it would sometimes deadlock in > > the page fault handler. > > > > access_ok() only checks if the pointer is in the user space virtual > > address space - not that a valid mapping exists and is writable. So > > BUG_ON(__put_user()) should not be done. > > Very true. Thanks for the pointer. Clearly the reason for the gather_array/traverse_pages structure. /me has flashbacks to the mammoth debugging session which led to http://xenbits.xen.org/hg/linux-2.6.18-xen.hg/rev/043dc7488c11. Ian.