diff --git a/kernel/fork.c b/kernel/fork.c index 74f6f5e26ee4..0db40e63ae28 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -486,7 +486,7 @@ EXPORT_SYMBOL(free_task); static __latent_entropy int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) { - struct vm_area_struct *mpnt, *tmp, *prev, **pprev, *last = NULL; + struct vm_area_struct *mpnt, *tmp, *prev, **pprev; struct rb_node **rb_link, *rb_parent; int retval; unsigned long charge; @@ -605,18 +605,8 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, rb_parent = &tmp->vm_rb; mm->map_count++; - if (!(tmp->vm_flags & VM_WIPEONFORK)) { - if (IS_ENABLED(CONFIG_SPECULATIVE_PAGE_FAULT)) { - /* - * Mark this VMA as changing to prevent the - * speculative page fault hanlder to process - * it until the TLB are flushed below. - */ - last = mpnt; - vm_write_begin(mpnt); - } + if (!(tmp->vm_flags & VM_WIPEONFORK)) retval = copy_page_range(mm, oldmm, mpnt); - } if (tmp->vm_ops && tmp->vm_ops->open) tmp->vm_ops->open(tmp); @@ -629,22 +619,6 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, out: up_write(&mm->mmap_sem); flush_tlb_mm(oldmm); - - if (IS_ENABLED(CONFIG_SPECULATIVE_PAGE_FAULT)) { - /* - * Since the TLB has been flush, we can safely unmark the - * copied VMAs and allows the speculative page fault handler to - * process them again. - * Walk back the VMA list from the last marked VMA. - */ - for (; last; last = last->vm_prev) { - if (last->vm_flags & VM_DONTCOPY) - continue; - if (!(last->vm_flags & VM_WIPEONFORK)) - vm_write_end(last); - } - } - up_write(&oldmm->mmap_sem); dup_userfaultfd_complete(&uf); fail_uprobe_end: