Subject: Re: linux-next: manual merge of the mm tree with Linus' tree

From: Will Deacon <[email-masked]>
Date: Tue, 20 Jun 2023 10:43:14 +0100

On Mon, Jun 19, 2023 at 02:39:44PM -0700, Andrew Morton wrote:
> On Mon, 19 Jun 2023 21:43:11 +0100 Will Deacon <[email-masked]> wrote:
> 
> > >   	/*
> > >   	 * Do not downgrade mmap_lock if we are next to VM_GROWSDOWN or
> > >   	 * VM_GROWSUP VMA. Such VMAs can change their size under
> > 
> > This resolution seems to be causing horrible problems on arm64 with 16k
> > pages. I see things like the crash below, but the two branches being merged
> > are fine on their own.
> 
> I've dropped the mm.git side of this conflict so next -next should
> be better.

Thanks, Andrew. next-20230620 is still broken, so I came up with the diff
below in the meantime which seems to resolve the crashes. I don't pretend
to understand the VMA iterator stuff well enough though, so I may have
missed something else.

Will

--->8

diff --git a/mm/mmap.c b/mm/mmap.c
index 9a93b054148a..4c82e9b36fb3 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2396,6 +2396,7 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma,
                        if (error)
                                goto end_split_failed;
                }
+               mas_set(&mas_detach, count);
                vma_start_write(next);
                if (mas_store_gfp(&mas_detach, next, GFP_KERNEL))
                        goto munmap_gather_failed;