[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



On Tue, 2012-08-07 at 10:53 +0100, Wangzhenguo wrote:
> > the page being COW when hyper calling*/
> > > +    madvise(p, nr_pages * PAGE_SIZE, MADV_DONTFORK);
> > 
> > madvise(2) tells me that MADV_{DO,DONT}FORK are Linux specific, so I
> > think this belongs in the Linux specific alloc_hypercall_buffer hook.
> 
> I don't think so. We only need madvise(MADV_DONTFORK) before hypercall, 
> and madvise(MADV_DOFORK) after hypercall. The pages in the hypercall buffer 
> need not be protected.

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.

>  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®.