summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2019-12-01 04:57:58 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2019-12-01 23:59:10 +0300
commit9d4678eb170c4c632174d1fec8ecee31c2f314f9 (patch)
tree42c77ee3dd514f345e0cf52b1d5cebe0697a4ed6 /fs
parent643aa36eadebdcdcaeecf538f0549a619ad78ea0 (diff)
downloadlinux-9d4678eb170c4c632174d1fec8ecee31c2f314f9.tar.xz
fs/userfaultfd.c: wp: clear VM_UFFD_MISSING or VM_UFFD_WP during userfaultfd_register()
If the registration is repeated without VM_UFFD_MISSING or VM_UFFD_WP they need to be cleared. Currently setting UFFDIO_REGISTER_MODE_WP returns -EINVAL, so this patch is a noop until the UFFDIO_REGISTER_MODE_WP support is applied. Link: http://lkml.kernel.org/r/20191004232834.GP13922@redhat.com Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Reported-by: Wei Yang <richardw.yang@linux.intel.com> Reviewed-by: Wei Yang <richardw.yang@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/userfaultfd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index f9fd18670e22..d90c4c5aa3cc 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -1460,7 +1460,8 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
start = vma->vm_start;
vma_end = min(end, vma->vm_end);
- new_flags = (vma->vm_flags & ~vm_flags) | vm_flags;
+ new_flags = (vma->vm_flags &
+ ~(VM_UFFD_MISSING|VM_UFFD_WP)) | vm_flags;
prev = vma_merge(mm, prev, start, vma_end, new_flags,
vma->anon_vma, vma->vm_file, vma->vm_pgoff,
vma_policy(vma),