The patch titled Subject: mm: do not call do_fault_around for non-linear fault has been added to the -mm tree. Its filename is mm-do-not-call-do_fault_around-for-non-linear-fault.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-do-not-call-do_fault_around-for-non-linear-fault.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-do-not-call-do_fault_around-for-non-linear-fault.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Konstantin Khlebnikov <koct9i@xxxxxxxxx> Subject: mm: do not call do_fault_around for non-linear fault Ingo Korb reported that "repeated mapping of the same file on tmpfs using remap_file_pages sometimes triggers a BUG at mm/filemap.c:202 when the process exits". He bisected the bug to d7c1755179b82d ("mm: implement ->map_pages for shmem/tmpfs"), although the bug was actually added by 8c6e50b0290c4 ("mm: introduce vm_ops->map_pages()"). Problem is caused by calling do_fault_around for _non-linear_ faiult. In this case pgoff is shifted and might become negative during calculation. Faulting around non-linear page-fault has no sense and breaks logic in do_fault_around because pgoff is shifted. Signed-off-by: Konstantin Khlebnikov <koct9i@xxxxxxxxx> Reported-by: "Ingo Korb" <ingo.korb@xxxxxxxxxxxxxx> Tested-by: "Ingo Korb" <ingo.korb@xxxxxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Sasha Levin <sasha.levin@xxxxxxxxxx> Cc: Dave Jones <davej@xxxxxxxxxx> Cc: Ning Qu <quning@xxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> [3.15.x] Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN mm/memory.c~mm-do-not-call-do_fault_around-for-non-linear-fault mm/memory.c --- a/mm/memory.c~mm-do-not-call-do_fault_around-for-non-linear-fault +++ a/mm/memory.c @@ -2882,7 +2882,8 @@ static int do_read_fault(struct mm_struc * if page by the offset is not ready to be mapped (cold cache or * something). */ - if (vma->vm_ops->map_pages && fault_around_pages() > 1) { + if (vma->vm_ops->map_pages && !(flags & FAULT_FLAG_NONLINEAR) && + fault_around_pages() > 1) { pte = pte_offset_map_lock(mm, pmd, address, &ptl); do_fault_around(vma, address, pte, pgoff, flags); if (!pte_same(*pte, orig_pte)) _ Patches currently in -mm which might be from koct9i@xxxxxxxxx are mm-do-not-call-do_fault_around-for-non-linear-fault.patch shmem-fix-faulting-into-a-hole-not-taking-i_mutex.patch shmem-fix-splicing-from-a-hole-while-its-punched.patch mm-fs-fix-pessimization-in-hole-punching-pagecache.patch mm-memoryc-use-entry-=-access_oncepte-in-handle_pte_fault.patch include-linux-mmdebugh-add-vm_warn_once.patch shmem-fix-double-uncharge-in-__shmem_file_setup.patch shmem-update-memory-reservation-on-truncate.patch mm-catch-memory-commitment-underflow.patch mm-catch-memory-commitment-underflow-fix.patch lib-idr-fix-out-of-bounds-pointer-dereference.patch scripts-checkstackpl-automatically-handle-32-bit-and-64-bit-mode-for-arch=x86.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html