Hugh Dickins 878b63ac88 mm: gup persist for write permission
do_wp_page()'s VM_FAULT_WRITE return value tells __get_user_pages() that
COW has been done if necessary, though it may be leaving the pte without
write permission - for the odd case of forced writing to a readonly vma
for ptrace.  At present GUP then retries the follow_page() without asking
for write permission, to escape an endless loop when forced.

But an application may be relying on GUP to guarantee a writable page
which won't be COWed again when written from userspace, whereas a race
here might leave a readonly pte in place?  Change the VM_FAULT_WRITE
handling to ask follow_page() for write permission again, except in that
odd case of forced writing to a readonly vma.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Robin Holt <holt@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-06 15:59:03 -08:00
..
2008-12-29 11:27:46 +02:00
2009-01-06 15:58:59 -08:00
2008-10-20 08:50:26 -07:00
2008-12-29 11:27:46 +02:00
2008-10-23 08:55:02 -07:00
2009-01-06 15:59:03 -08:00
2008-11-14 11:29:12 +11:00
2007-10-20 01:27:18 +02:00
2009-01-06 15:59:02 -08:00
2008-04-28 08:58:18 -07:00
2008-12-20 09:15:47 +01:00
2009-01-05 17:44:42 -08:00
2008-07-28 16:30:21 -07:00
2009-01-05 17:44:42 -08:00
2009-01-05 11:54:28 -05:00
2009-01-05 11:54:28 -05:00
2008-06-12 18:05:41 -07:00
2009-01-01 10:12:29 +10:30
2007-10-20 01:27:18 +02:00
2009-01-01 10:12:29 +10:30
2009-01-01 10:12:29 +10:30
2008-11-30 10:03:35 -08:00
2009-01-06 15:59:02 -08:00
2009-01-01 10:12:29 +10:30
2009-01-01 10:12:29 +10:30