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

Re: [Xen-devel] how to deal with copy_to_user returning non zero

On 07/11/14 10:57, And Dinh wrote:
how does it get page fault? I made sure the output buffer at the user space is properly allocated with the correct Âsize.

When page fault, do I have no choice but abort? It seems calling the hypercall again does not solve it.

And nothing guarentees that your userspace process is in context when Xen is running, or that the kernel hasn't played with the pagetables behind your back.

You must use the hypercall buffer mechanism to avoid issues like this. See the hypercall implementations in libxc. In Xen, you must have a XEN_GUEST_HANDLE() which is an opaque reference to your buffer, and use copy_{to,from}_guest() rather than {to/from}_user(), which is generally only safe for kernel addresses.

Xen-devel mailing list



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