[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGQJCaZiPDjYS8w4@x1n>
Date: Tue, 16 May 2023 18:51:53 -0400
From: Peter Xu <peterx@...hat.com>
To: "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Lorenzo Stoakes <lstoakes@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Rapoport <rppt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>
Subject: Re: [PATCH v2] mm: userfaultfd: avoid passing an invalid range to
vma_merge()
On Tue, May 16, 2023 at 06:38:30PM -0400, Liam R. Howlett wrote:
> > It seems to me what you're trying to explain is we shouldn't handle any
> > split in vma_merge() so we should move cases 4 & 5 out of vma_merge(). If
> > we split first then merge, cases 4 & 5 will become case 2 & 3 after split.
>
> We don't split in case 4 or 5 - we adjust the existing VMA limits. We
> don't actually handle any splits in vma_merge(). I think splitting
> first would change 4 & 5 to 7 & 8? 2 & 3 would require a split and
> munmap, right?
Right, I referenced to the wrong numbers.. 2 & 3 are when CUR (CCCC) is
empty and newly mapped in, if split happened it means CUR (CCCC) exists
which is 7 & 8 correspondingly.
>
> > My question would be: if it worked perfect in the past few years and it
> > looks all good enough, why bother..
>
> I suspect, but it's not clear (like all of this), that the other
> arguments to vma_merge() is ruling out this potential hazard I thought
> existed.
Some more elaborations on this one would be appreciated.
Thanks,
--
Peter Xu
Powered by blists - more mailing lists