* + mm-mremap-permit-mremap-move-of-multiple-vmas-fix.patch added to mm-unstable branch
@ 2025-07-12 22:55 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-07-12 22:55 UTC (permalink / raw)
To: mm-commits, viro, vbabka, riel, peterx, liam.howlett, jannh, jack,
brauner, lorenzo.stoakes, akpm
The patch titled
Subject: mm/mremap: address review comments
has been added to the -mm mm-unstable branch. Its filename is
mm-mremap-permit-mremap-move-of-multiple-vmas-fix.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mremap-permit-mremap-move-of-multiple-vmas-fix.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Subject: mm/mremap: address review comments
Date: Fri, 11 Jul 2025 15:06:06 +0100
Make seen_vma a local variable, and add a comment when vmi_needs_reset is
set to explain what it's for.
Link: https://lkml.kernel.org/r/e5a58805-e621-4628-b78d-f5d6e4b6334c@lucifer.local
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mremap.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- a/mm/mremap.c~mm-mremap-permit-mremap-move-of-multiple-vmas-fix
+++ a/mm/mremap.c
@@ -69,7 +69,6 @@ struct vma_remap_struct {
enum mremap_type remap_type; /* expand, shrink, etc. */
bool mmap_locked; /* Is mm currently write-locked? */
unsigned long charged; /* If VM_ACCOUNT, # pages to account. */
- bool seen_vma; /* Is >1 VMA being moved? */
bool vmi_needs_reset; /* Was the VMA iterator invalidated? */
};
@@ -1188,6 +1187,7 @@ static int copy_vma_and_data(struct vma_
*new_vma_ptr = NULL;
return -ENOMEM;
}
+ /* By merging, we may have invalidated any iterator in use. */
if (vma != vrm->vma)
vrm->vmi_needs_reset = true;
@@ -1805,10 +1805,10 @@ static unsigned long remap_move(struct v
unsigned long start = vrm->addr;
unsigned long end = vrm->addr + vrm->old_len;
unsigned long new_addr = vrm->new_addr;
+ bool allowed = true, seen_vma = false;
unsigned long target_addr = new_addr;
unsigned long res = -EFAULT;
unsigned long last_end;
- bool allowed = true;
VMA_ITERATOR(vmi, current->mm, start);
/*
@@ -1826,7 +1826,7 @@ static unsigned long remap_move(struct v
return -EFAULT;
/* No gap permitted at the start of the range. */
- if (!vrm->seen_vma && start < vma->vm_start)
+ if (!seen_vma && start < vma->vm_start)
return -EFAULT;
/*
@@ -1844,7 +1844,7 @@ static unsigned long remap_move(struct v
*
* So we map B' at A'->vm_end + X, and C' at B'->vm_end + Y.
*/
- offset = vrm->seen_vma ? vma->vm_start - last_end : 0;
+ offset = seen_vma ? vma->vm_start - last_end : 0;
last_end = vma->vm_end;
vrm->vma = vma;
@@ -1853,7 +1853,7 @@ static unsigned long remap_move(struct v
vrm->old_len = vrm->new_len = len;
allowed = vma_multi_allowed(vma);
- if (vrm->seen_vma && !allowed)
+ if (seen_vma && !allowed)
return -EFAULT;
res_vma = check_prep_vma(vrm);
@@ -1862,7 +1862,7 @@ static unsigned long remap_move(struct v
if (IS_ERR_VALUE(res_vma))
return res_vma;
- if (!vrm->seen_vma) {
+ if (!seen_vma) {
VM_WARN_ON_ONCE(allowed && res_vma != new_addr);
res = res_vma;
}
@@ -1876,7 +1876,7 @@ static unsigned long remap_move(struct v
vma_iter_reset(&vmi);
vrm->vmi_needs_reset = false;
}
- vrm->seen_vma = true;
+ seen_vma = true;
target_addr = res_vma + vrm->new_len;
}
_
Patches currently in -mm which might be from lorenzo.stoakes@oracle.com are
mm-madvise-remove-the-visitor-pattern-and-thread-anon_vma-state.patch
mm-madvise-thread-mm_struct-through-madvise_behavior.patch
mm-madvise-thread-vma-range-state-through-madvise_behavior.patch
mm-madvise-thread-all-madvise-state-through-madv_behavior.patch
mm-madvise-eliminate-very-confusing-manipulation-of-prev-vma.patch
mm-madvise-eliminate-very-confusing-manipulation-of-prev-vma-fix.patch
tools-testing-selftests-add-mremap-unfaulted-faulted-test-cases.patch
mm-mremap-perform-some-simple-cleanups.patch
mm-mremap-refactor-initial-parameter-sanity-checks.patch
mm-mremap-put-vma-check-and-prep-logic-into-helper-function.patch
mm-mremap-cleanup-post-processing-stage-of-mremap.patch
mm-mremap-use-an-explicit-uffd-failure-path-for-mremap.patch
mm-mremap-check-remap-conditions-earlier.patch
mm-mremap-move-remap_is_valid-into-check_prep_vma.patch
mm-mremap-clean-up-mlock-populate-behaviour.patch
mm-mremap-permit-mremap-move-of-multiple-vmas.patch
mm-mremap-permit-mremap-move-of-multiple-vmas-fix.patch
tools-testing-selftests-extend-mremap_test-to-test-multi-vma-mremap.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-12 22:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12 22:55 + mm-mremap-permit-mremap-move-of-multiple-vmas-fix.patch added to mm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.