Re: [PATCH] restore protections after forced fault in get_user_pages

From: Linus Torvalds
Date: Mon Feb 02 2004 - 18:57:02 EST




On Mon, 2 Feb 2004, Roland McGrath wrote:
>
> It would be ideal. However, it would also require changing the interfaces
> further. Currently handle_mm_fault just says what happened, and doesn't
> give back the page directly. get_user_pages then retakes
> mm->page_table_lock and calls follow_page to look up the page.

I'd suggest making this be:
- handle_mm_fault() take a more detailed flag ("read / write / copy",
where the new "copy" part is a write that actually leaves the page
only readable, but marks it dirty)
- we do "follow-page" with a read.

That should be sufficient, I think: since "handle_mm_fault()" marks the
page dirty (but not writable) and will have done all the work to do a COW,
we know that once we do the "follow_page()", we'll be getting a private
copy. Which is what we wanted.

So only "handle_mm_fault()" would actually need changing.

I think.

Anybody see any problems with this approach?

Linus
-
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/