* + mm-mremap-catch-invalid-multi-vma-moves-earlier-fix.patch added to mm-hotfixes-unstable branch
@ 2025-08-17 17:41 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-08-17 17:41 UTC (permalink / raw)
To: mm-commits, vbabka, lorenzo.stoakes, akpm
The patch titled
Subject: mm/mremap: do not incorrectly reference invalid VMA in VM_WARN_ON_ONCE()
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-mremap-catch-invalid-multi-vma-moves-earlier-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-catch-invalid-multi-vma-moves-earlier-fix.patch
This patch will later appear in the mm-hotfixes-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: do not incorrectly reference invalid VMA in VM_WARN_ON_ONCE()
Date: Sat, 16 Aug 2025 08:37:41 +0100
The VMA which is referenced here may have since been merged (which is the
entire point of the warning), and yet we still reference it.
Fix this by storing whether or not a multi move is permitted ahead of time
and have the VM_WARN_ON_ONCE() be predicated on this.
Link: https://lkml.kernel.org/r/b6dbda20-667e-4053-abae-8ed4fa84bb6c@lucifer.local
Reported-by: syzbot+4e221abf50259362f4f4@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-mm/689ff5f6.050a0220.e29e5.0030.GAE@google.com/
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mremap.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/mm/mremap.c~mm-mremap-catch-invalid-multi-vma-moves-earlier-fix
+++ a/mm/mremap.c
@@ -1837,6 +1837,7 @@ static unsigned long remap_move(struct v
unsigned long addr = max(vma->vm_start, start);
unsigned long len = min(end, vma->vm_end) - addr;
unsigned long offset, res_vma;
+ bool multi_allowed;
/* No gap permitted at the start of the range. */
if (!seen_vma && start < vma->vm_start)
@@ -1865,7 +1866,8 @@ static unsigned long remap_move(struct v
vrm->new_addr = target_addr + offset;
vrm->old_len = vrm->new_len = len;
- if (!vma_multi_allowed(vma)) {
+ multi_allowed = vma_multi_allowed(vma);
+ if (!multi_allowed) {
/* This is not the first VMA, abort immediately. */
if (seen_vma)
return -EFAULT;
@@ -1881,8 +1883,7 @@ static unsigned long remap_move(struct v
return res_vma;
if (!seen_vma) {
- VM_WARN_ON_ONCE(vma_multi_allowed(vma) &&
- res_vma != new_addr);
+ VM_WARN_ON_ONCE(multi_allowed && res_vma != new_addr);
res = res_vma;
}
_
Patches currently in -mm which might be from lorenzo.stoakes@oracle.com are
tools-testing-add-linux-argsh-header-and-fix-radix-vma-tests.patch
mm-mremap-allow-multi-vma-move-when-filesystem-uses-thp_get_unmapped_area.patch
mm-mremap-catch-invalid-multi-vma-moves-earlier.patch
mm-mremap-catch-invalid-multi-vma-moves-earlier-fix.patch
selftests-mm-add-test-for-invalid-multi-vma-operations.patch
mm-add-bitmap-mm-flags-field.patch
mm-add-bitmap-mm-flags-field-fix.patch
mm-convert-core-mm-to-mm_flags_-accessors.patch
mm-convert-prctl-to-mm_flags_-accessors.patch
mm-convert-arch-specific-code-to-mm_flags_-accessors.patch
mm-convert-arch-specific-code-to-mm_flags_-accessors-fix.patch
mm-convert-uprobes-to-mm_flags_-accessors.patch
mm-update-coredump-logic-to-correctly-use-bitmap-mm-flags.patch
mm-correct-sign-extension-issue-in-mmf_-flag-masks.patch
mm-update-fork-mm-flags-initialisation-to-use-bitmap.patch
mm-convert-remaining-users-to-mm_flags_-accessors.patch
mm-replace-mm-flags-with-bitmap-entirely-and-set-to-64-bits.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-17 17:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-17 17:41 + mm-mremap-catch-invalid-multi-vma-moves-earlier-fix.patch added to mm-hotfixes-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.