Messages in this thread Patch in this message | | | From | Laurent Dufour <> | Subject | [RFC v4 16/20] mm/spf: Don't call user fault callback in the speculative path | Date | Fri, 9 Jun 2017 16:21:05 +0200 |
| |
The handle_userfault() function assumes that the mmap_sem is held which is not true in the case of a speculative page fault handling.
When doing a speculative page fault, lets retry it in the usual path to call handle_userfault().
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> --- mm/memory.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/mm/memory.c b/mm/memory.c index 27e44ebc5440..5b158549789b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3005,6 +3005,8 @@ static int do_anonymous_page(struct vm_fault *vmf) /* Deliver the page fault to userland, check inside PT lock */ if (userfaultfd_missing(vma)) { pte_unmap_unlock(vmf->pte, vmf->ptl); + if (vmf->flags & FAULT_FLAG_SPECULATIVE) + return VM_FAULT_RETRY; return handle_userfault(vmf, VM_UFFD_MISSING); } goto setpte; @@ -3045,6 +3047,8 @@ static int do_anonymous_page(struct vm_fault *vmf) pte_unmap_unlock(vmf->pte, vmf->ptl); mem_cgroup_cancel_charge(page, memcg, false); put_page(page); + if (vmf->flags & FAULT_FLAG_SPECULATIVE) + return VM_FAULT_RETRY; return handle_userfault(vmf, VM_UFFD_MISSING); } -- 2.7.4
| |