The patch titled Subject: userfaultfd: mcopy_atomic: update cases returning -ENOENT has been removed from the -mm tree. Its filename was userfaultfd-mcopy_atomic-return-enoent-when-no-compatible-vma-found-fix.patch This patch was dropped because it was folded into userfaultfd-mcopy_atomic-return-enoent-when-no-compatible-vma-found.patch ------------------------------------------------------ From: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Subject: userfaultfd: mcopy_atomic: update cases returning -ENOENT As Andrea commented in [1], if the VMA covering the address was unmapped, we may end up with a VMA a way above the faulting address. In this case we would like to return -ENOENT to allow uffd monitor detection of VMA removal. [1] http://www.spinics.net/lists/linux-mm/msg121267.html Link: http://lkml.kernel.org/r/20170207150249.GA6709@rapoport-lnx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxxxxxxx> Reviewed-by: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Hillf Danton <hillf.zj@xxxxxxxxxxxxxxx> Cc: "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Pavel Emelyanov <xemul@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/userfaultfd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff -puN mm/userfaultfd.c~userfaultfd-mcopy_atomic-return-enoent-when-no-compatible-vma-found-fix mm/userfaultfd.c --- a/mm/userfaultfd.c~userfaultfd-mcopy_atomic-return-enoent-when-no-compatible-vma-found-fix +++ a/mm/userfaultfd.c @@ -202,19 +202,15 @@ retry: if (!dst_vma || !is_vm_hugetlb_page(dst_vma)) goto out_unlock; - err = -EINVAL; - if (vma_hpagesize != vma_kernel_pagesize(dst_vma)) - goto out_unlock; - - /* - * Make sure the remaining dst range is both valid and - * fully within a single existing vma. - */ if (dst_start < dst_vma->vm_start || dst_start + len > dst_vma->vm_end) goto out_unlock; vm_shared = dst_vma->vm_flags & VM_SHARED; + + err = -EINVAL; + if (vma_hpagesize != vma_kernel_pagesize(dst_vma)) + goto out_unlock; } if (WARN_ON(dst_addr & (vma_hpagesize - 1) || @@ -227,6 +223,10 @@ retry: if (!dst_vma->vm_userfaultfd_ctx.ctx) goto out_unlock; + if (dst_start < dst_vma->vm_start || + dst_start + len > dst_vma->vm_end) + goto out_unlock; + /* * If not shared, ensure the dst_vma has a anon_vma. */ _ Patches currently in -mm which might be from rppt@xxxxxxxxxxxxxxxxxx are userfaultfd-non-cooperative-rename-event_madvdontneed-to-event_remove.patch userfaultfd-non-cooperative-add-madvise-event-for-madv_remove-request.patch userfaultfd-non-cooperative-selftest-enable-remove-event-test-for-shmem.patch mm-call-vm_munmap-in-munmap-syscall-instead-of-using-open-coded-version.patch userfaultfd-non-cooperative-add-event-for-memory-unmaps.patch userfaultfd-non-cooperative-add-event-for-exit-notification.patch userfaultfd-mcopy_atomic-return-enoent-when-no-compatible-vma-found.patch userfaultfd_copy-return-enospc-in-case-mm-has-gone.patch userfaultfd-documentation-update.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html