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

Re: [Xen-devel] The hypercall will fail and return EFAULT when the page becomes COW by forking process in linux



> -----Original Message-----
> From: Ian Campbell [mailto:Ian.Campbell@xxxxxxxxxx]
> Sent: Tuesday, August 07, 2012 6:07 PM

> The entire point of the hypercall buffer is that it needs to be safe
> for use as a hypercall argument, therefore it does need to be protected.

We won't protect pages in hypercall buffer cache. Hypercall buffer cache 
belongs to xc_interface, parent process calls xc_interface_open to get 
xc_interface handler, after fork, child process inherits the handler, and also 
inherits hypercall buffer cache which belongs to it. It will cause segment 
fault to access pages in the hypercall buffer cache by being delivered   to 
hypercall, because they are not invalidate in the child process. So, We need 
restore the status of pages before putting they to hypercall buffer cache, and 
prevent pages from COW after being allocated in hyprecall buffer cache.

> >  So two extra hooks are added in xc_osdep_ops.u.pricmd.
> 
> I don't understand why these new hooks are needed, you call the first
> immediately after (near enough) alloc_hypercall_buffer and the second
> immediately before free_hypercall_buffer. The semantics of both those
> existing calls are already that they must provide and release memory
> suitable for use as a hypercall argument, so I don't think having a
> separate prepare call which takes their result and does "really make
> this memory suitable" makes sense.
> 
> Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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