[PATCH] userfaultfd: do not set dirty accountable when changing protection

From: JÃrÃme Glisse
Date: Wed Sep 12 2018 - 08:58:33 EST


mwriteprotect_range() has nothing to do with the dirty accountable
optimization so do not set it as it opens a door for userspace to
unwrite protect pages in a range that is write protected ie the vma
!(vm_flags & VM_WRITE).

Signed-off-by: Jéme Glisse <jglisse@xxxxxxxxxx>
---
mm/userfaultfd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index a0379c5ffa7c..59db1ce48fa0 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -632,7 +632,7 @@ int mwriteprotect_range(struct mm_struct *dst_mm, unsigned long start,
newprot = vm_get_page_prot(dst_vma->vm_flags);

change_protection(dst_vma, start, start + len, newprot,
- !enable_wp, 0);
+ false, 0);

err = 0;
out_unlock:
--
2.17.1