Re: Nick's core remove PageReserved broke vmware...

From: Hugh Dickins
Date: Wed Nov 02 2005 - 17:03:56 EST


On Thu, 3 Nov 2005, Benjamin Herrenschmidt wrote:
> On Wed, 2005-11-02 at 21:41 +0000, Hugh Dickins wrote:
>
> > The only extant problem here is if the pages are private, and you
> > fork while this is going on, and the parent user process writes to the
> > area before completion: then COW leaves the child with the page being
> > DMAed into, giving the parent a copied page which may be incomplete.
>
> Won't happen, and if it does, it's a user error to rely on that working,
> so it doesn't matter.

I wish everyone else would see it that way! (But some people do
have valid scenarios where it can't just be ruled out completely.)

> > Take a look at Andrew's educational comment on set_page_dirty_lock
> > in mm/page-writeback.c. You do have the list of pages you need to
> > page_cache_release, don't you? So it should be easy to dirty them.
>
> Ok, so just passing 'write' to get_user_pages() is good enough; right ?

Not quite, I think: you need to pass 'write' to get_user_pages()
initially; but at the end, if it was indeed writing into user space,
you need to do the set_page_dirty_lock thing on each of the pages
before page_cache_release, just in case a race cleaned them before
the DMA completed. I think (I've never used it myself).

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/