[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJuCfpGODc=PpJFR2gUgpTAfn1sufvWWxQL5kGaHQ3dBpa1z1g@mail.gmail.com>
Date: Mon, 14 Aug 2023 13:06:44 -0700
From: Suren Baghdasaryan <surenb@...gle.com>
To: Jann Horn <jannh@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
torvalds@...ux-foundation.org, willy@...radead.org,
liam.howlett@...cle.com, david@...hat.com, peterx@...hat.com,
ldufour@...ux.ibm.com, vbabka@...e.cz, michel@...pinasse.org,
jglisse@...gle.com, mhocko@...e.com, hannes@...xchg.org,
dave@...olabs.net, hughd@...gle.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, kernel-team@...roid.com
Subject: Re: [PATCH v4 5/6] mm: always lock new vma before inserting into vma tree
On Mon, Aug 14, 2023 at 1:02 PM Jann Horn <jannh@...gle.com> wrote:
>
> On Mon, Aug 14, 2023 at 9:15 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
> > On Mon, 14 Aug 2023 16:54:01 +0200 Jann Horn <jannh@...gle.com> wrote:
> >
> > > > @@ -403,6 +403,8 @@ static int vma_link(struct mm_struct *mm, struct vm_area_struct *vma)
> > > >
> > > > vma_iter_store(&vmi, vma);
> > > >
> > > > + vma_start_write(vma);
> > > > +
> > > > if (vma->vm_file) {
> > > > mapping = vma->vm_file->f_mapping;
> > > > i_mmap_lock_write(mapping);
> > >
> > > The "vma_start_write()" has to be ordered before the
> > > "vma_iter_store(&vmi, vma)".
> >
> > Thanks. This?
> >
> >
> > --- a/mm/mmap.c~mm-always-lock-new-vma-before-inserting-into-vma-tree-fix
> > +++ a/mm/mmap.c
> > @@ -401,10 +401,10 @@ static int vma_link(struct mm_struct *mm
> > if (vma_iter_prealloc(&vmi, vma))
> > return -ENOMEM;
> >
> > - vma_iter_store(&vmi, vma);
> > -
> > vma_start_write(vma);
> >
> > + vma_iter_store(&vmi, vma);
> > +
> > if (vma->vm_file) {
> > mapping = vma->vm_file->f_mapping;
> > i_mmap_lock_write(mapping);
>
> Yes, thanks, that looks good.
Ack. Thanks!
Powered by blists - more mailing lists