--- x/kernel/fork.c +++ y/kernel/fork.c @@ -692,6 +692,8 @@ static __latent_entropy int dup_mmap(str for_each_vma(old_vmi, mpnt) { struct file *file; + vma_start_write(mpnt); + if (mpnt->vm_flags & VM_DONTCOPY) { vm_stat_account(mm, mpnt->vm_flags, -vma_pages(mpnt)); continue; --- x/mm/mmap.c +++ y/mm/mmap.c @@ -1977,6 +1977,7 @@ static int expand_upwards(struct vm_area return -ENOMEM; } + vma_start_write(vma); /* * vma->vm_start/vm_end cannot change under us because the caller * is required to hold the mmap_lock in read mode. We need the @@ -2064,6 +2065,7 @@ int expand_downwards(struct vm_area_stru return -ENOMEM; } + vma_start_write(vma); /* * vma->vm_start/vm_end cannot change under us because the caller * is required to hold the mmap_lock in read mode. We need the @@ -2805,6 +2807,7 @@ cannot_expand: if (vma_iter_prealloc(&vmi)) goto close_and_free_vma; + vma_start_write(vma); if (vma->vm_file) i_mmap_lock_write(vma->vm_file->f_mapping);