diff options
-rw-r--r-- | mm/memory.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c index 827d42f9ebf7..4d565d7c8016 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3090,6 +3090,14 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) return handle_userfault(vmf, VM_UFFD_WP); } + /* + * Userfaultfd write-protect can defer flushes. Ensure the TLB + * is flushed in this case before copying. + */ + if (unlikely(userfaultfd_wp(vmf->vma) && + mm_tlb_flush_pending(vmf->vma->vm_mm))) + flush_tlb_page(vmf->vma, vmf->address); + vmf->page = vm_normal_page(vma, vmf->address, vmf->orig_pte); if (!vmf->page) { /* |