linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Lorenzo Stoakes <lstoakes@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Mike Rapoport <rppt@kernel.org>,
	peterx@redhat.com, Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH 0/2] mm/uffd: Fix vma merge/split
Date: Wed, 17 May 2023 11:04:06 -0400	[thread overview]
Message-ID: <20230517150408.3411044-1-peterx@redhat.com> (raw)

This series contains two patches that fix vma merge/split for userfaultfd
on two separate issues.  The patchset is based on akpm/mm-hotfixes-unstable
with 2f628010799e reverted (where patch 1 should be used to replace it
which seems to be the plan we reached).

The major changes comparing to the patches I attached to the reply:

  - Fixed up patch 1 on vma_prev() side effect pointed out by Liam, further
    I simplified it to just bring back the two lines missing, so even shorter.

  - Add fixes tags for both patches, I decided to copy stable for both
    patch in this version, even though patch 2 is more or less tentative
    (as I don't see anything wrong besides vma didn't trigger a merge).

Patch 1 fixes a regression since 6.1+ due to something we overlooked when
converting to maple tree apis.  The plan is we use patch 1 to replace the
commit "2f628010799e (mm: userfaultfd: avoid passing an invalid range to
vma_merge())" in mm-hostfixes-unstable tree if possible, so as to bring
uffd vma operations back aligned with the rest code again.

Patch 2 fixes a long standing issue that vma can be left unmerged even if
we can for either uffd register or unregister.

Many thanks to Lorenzo on either noticing this issue from the assert
movement patch, looking at this problem, and also provided a reproducer on
the unmerged vma issue [1].

Please have a look, thanks.

[1] https://gist.github.com/lorenzo-stoakes/a11a10f5f479e7a977fc456331266e0e

Peter Xu (2):
  mm/uffd: Fix vma operation where start addr cuts part of vma
  mm/uffd: Allow vma to merge as much as possible

 fs/userfaultfd.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-- 
2.39.1



             reply	other threads:[~2023-05-17 15:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 15:04 Peter Xu [this message]
2023-05-17 15:04 ` [PATCH 1/2] mm/uffd: Fix vma operation where start addr cuts part of vma Peter Xu
2023-05-17 17:20   ` Lorenzo Stoakes
2023-05-17 18:37     ` Peter Xu
2023-05-17 18:40       ` Lorenzo Stoakes
2023-05-17 18:54         ` Peter Xu
2023-05-17 19:03           ` Lorenzo Stoakes
2023-05-17 18:01   ` Liam R. Howlett
2023-05-17 15:04 ` [PATCH 2/2] mm/uffd: Allow vma to merge as much as possible Peter Xu
2023-05-17 17:23   ` Lorenzo Stoakes
2023-05-17 18:39     ` Peter Xu
2023-05-17 18:01   ` Liam R. Howlett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230517150408.3411044-1-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=rppt@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox