From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: how to deal with copy_to_user returning non zero Date: Mon, 10 Nov 2014 10:04:08 +0000 Message-ID: <1415613848.27002.3.camel@citrix.com> References: <545CA29A.2040703@citrix.com> <545CA690.8090507@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Anh Dinh Cc: Andrew Cooper , "" List-Id: xen-devel@lists.xenproject.org On Sun, 2014-11-09 at 09:22 +0800, Anh Dinh wrote: > Thanks, > > > I've found out the reason it page-faulting is because I used malloc() > to allocate the output buffer, which turns out to allocate lazily. > Therefore the hypervisor page-fault because the memory is still > waiting to be mapped by the kernel. > > > I simply touched all the allocated memory, and it works fine now. It might work, but unless it is using hypercall buffers and XEN_GUEST_HANDLE then it is still subtly broken. Ian.