From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,xu.xin@linux.dev,willy@infradead.org,
vbabka@kernel.org,surenb@google.com,shakeel.butt@linux.dev,rppt@kernel.org,
pfalcato@suse.de,mhocko@suse.com,ljs@kernel.org,liam@infradead.org,
kees@kernel.org,josef@toxicpanda.com,joey.gouly@arm.com,jannh@google.com,
hughd@google.com,gourry@gourry.net,david@kernel.org,chengming.zhou@linux.dev,
catalin.marinas@arm.com,bunk@stusta.de,azpijr@gmail.com,
a.p.zijlstra@chello.nl,aaw@google.com,mason@kernel.org,
akpm@linux-foundation.org
Subject: + mm-mremap-respect-guard-gaps-on-in-place-expansion.patch added to mm-new branch
Date: Tue, 24 Nov 2026 15:29:38 -0800 [thread overview]
Message-ID: <20261124232938.CD7E01F000D0@smtp.kernel.org> (raw)
In-Reply-To: <20261121-some-more-ai-fixes-v1-6-236e925d9b64@kernel.org>
The patch titled
Subject: mm/mremap: respect guard gaps on in-place expansion
has been added to the -mm mm-new branch. Its filename is
mm-mremap-respect-guard-gaps-on-in-place-expansion.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mremap-respect-guard-gaps-on-in-place-expansion.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
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 various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Chris Mason <mason@kernel.org>
Subject: mm/mremap: respect guard gaps on in-place expansion
Date: Sat, 21 Nov 2026 16:02:32 +0000
Growing a mapping in place can let it use up the guard gap below a
stack, so that the stack can't grow any further, or overflows into the
mapping instead of faulting.
A mapping has to stay out of the gap of the next VMA unless the caller
fixed its address. But vma_expandable() only checks that the new range
doesn't intersect the next VMA, and it passes MAP_FIXED to
get_unmapped_area(), which skips the gap check there.
Fix the issue by stopping in-place growth at the start of the gap.
Growing a mapping into or within the gap of a stack or shadow stack now
fails with ENOMEM without MREMAP_MAYMOVE, or if the mapping can't be
moved.
Link: https://patch.msgid.link/20261121-some-more-ai-fixes-v1-6-236e925d9b64@kernel.org
Fixes: 1be7107fbe18 ("mm: larger stack guard gap, between vmas")
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Tested-by: Gregory Price (Meta) <gourry@gourry.net>
Link: https://lore.kernel.org/179536256259.412063.8859349312024671580.b4-reply@b4
Reviewed-by: Gregory Price (Meta) <gourry@gourry.net>
Reviewed-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: David Hildenbrand <david@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ollie Wild <aaw@google.com>
Cc: Adrian Bunk <bunk@stusta.de>
Cc: Xu Xin <xu.xin@linux.dev>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Josef Bacik <josef@toxicpanda.com>
mm/mremap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/mm/mremap.c~mm-mremap-respect-guard-gaps-on-in-place-expansion
+++ a/mm/mremap.c
@@ -1509,10 +1509,12 @@ static unsigned long mremap_to(struct vm
static int vma_expandable(struct vm_area_struct *vma, unsigned long delta)
{
unsigned long end = vma->vm_end + delta;
+ struct vm_area_struct *next;
if (end < vma->vm_end) /* overflow */
return 0;
- if (find_vma_intersection(vma->vm_mm, vma->vm_end, end))
+ next = find_vma(vma->vm_mm, vma->vm_end);
+ if (next && end > vm_start_gap(next)) /* intersection, or in its gap */
return 0;
if (get_unmapped_area(NULL, vma->vm_start, end - vma->vm_start,
0, MAP_FIXED) & ~PAGE_MASK)
_
Patches currently in -mm which might be from mason@kernel.org are
mm-swap-fix-large-swap-in-across-swap-file-extents.patch
hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch
mm-hugetlb-keep-surplus-folios-that-are-reserved.patch
mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch
mm-cachestat-count-each-page-only-once.patch
mm-cachestat-restart-the-walk-after-each-entry.patch
percpu-queue-the-balance-work-on-an-unbound-workqueue.patch
mm-vma-fix-uncharge-after-failed-stack-relocation.patch
mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch
mm-mremap-respect-guard-gaps-on-in-place-expansion.patch
mm-vma-make-brk-mappings-non-executable-under-mdwe.patch
next prev parent reply other threads:[~2026-11-24 23:29 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 16:02 [PATCH 0/7] mm: reworked AI-generated VMA and mremap fixes Lorenzo Stoakes (ARM)
2026-11-21 16:02 ` [PATCH 1/7] mm/vma: error out on invalid bounds in unmapped_area_topdown() Lorenzo Stoakes (ARM)
2026-11-22 3:20 ` Suren Baghdasaryan
2026-11-22 15:55 ` Gregory Price (Meta)
2026-11-22 18:03 ` Jose A. Perez de Azpillaga
2026-11-24 23:29 ` + mm-vma-error-out-on-invalid-bounds-in-unmapped_area_topdown.patch added to mm-new branch Andrew Morton
2026-11-21 16:02 ` [PATCH 2/7] mm/vma: lock VMAs before taking mm_all_locks_mutex Lorenzo Stoakes (ARM)
2026-11-22 3:23 ` Suren Baghdasaryan
2026-11-22 15:53 ` Gregory Price (Meta)
2026-11-22 18:03 ` Jose A. Perez de Azpillaga
2026-11-24 23:29 ` + mm-vma-lock-vmas-before-taking-mm_all_locks_mutex.patch added to mm-new branch Andrew Morton
2026-11-21 16:02 ` [PATCH 3/7] mm/ksm: only interrupt unmerging on a fatal signal Lorenzo Stoakes (ARM)
2026-11-22 3:27 ` Suren Baghdasaryan
2026-11-22 15:54 ` David Hildenbrand (Arm)
2026-11-22 15:56 ` Gregory Price (Meta)
2026-11-21 16:02 ` [PATCH 4/7] mm/vma: fix uncharge after failed stack relocation Lorenzo Stoakes (ARM)
2026-11-22 3:34 ` Suren Baghdasaryan
2026-11-22 15:50 ` Gregory Price (Meta)
2026-11-22 16:04 ` sashiko-bot
2026-11-24 23:29 ` + mm-vma-fix-uncharge-after-failed-stack-relocation.patch added to mm-new branch Andrew Morton
2026-11-21 16:02 ` [PATCH 5/7] mm/mremap: apply the mmap() offset limits on expansion Lorenzo Stoakes (ARM)
2026-11-22 3:37 ` Suren Baghdasaryan
2026-11-22 15:50 ` Gregory Price (Meta)
2026-11-22 18:03 ` Jose A. Perez de Azpillaga
2026-11-24 23:29 ` + mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch added to mm-new branch Andrew Morton
2026-11-21 16:02 ` [PATCH 6/7] mm/mremap: respect guard gaps on in-place expansion Lorenzo Stoakes (ARM)
2026-11-22 3:41 ` Suren Baghdasaryan
2026-11-22 15:49 ` Gregory Price (Meta)
2026-11-22 18:03 ` Jose A. Perez de Azpillaga
2026-11-24 23:29 ` Andrew Morton [this message]
2026-11-21 16:02 ` [PATCH 7/7] mm/vma: make brk mappings non-executable under MDWE Lorenzo Stoakes (ARM)
2026-11-22 3:46 ` Suren Baghdasaryan
2026-11-22 15:48 ` Gregory Price (Meta)
2026-11-22 18:03 ` Jose A. Perez de Azpillaga
2026-11-24 23:29 ` + mm-vma-make-brk-mappings-non-executable-under-mdwe.patch added to mm-new branch Andrew Morton
2026-11-22 15:55 ` (subset) [PATCH 0/7] mm: reworked AI-generated VMA and mremap fixes David Hildenbrand
2026-11-22 15:57 ` Gregory Price (Meta)
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=20261124232938.CD7E01F000D0@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=a.p.zijlstra@chello.nl \
--cc=aaw@google.com \
--cc=azpijr@gmail.com \
--cc=bunk@stusta.de \
--cc=catalin.marinas@arm.com \
--cc=chengming.zhou@linux.dev \
--cc=david@kernel.org \
--cc=gourry@gourry.net \
--cc=hughd@google.com \
--cc=jannh@google.com \
--cc=joey.gouly@arm.com \
--cc=josef@toxicpanda.com \
--cc=kees@kernel.org \
--cc=liam@infradead.org \
--cc=ljs@kernel.org \
--cc=mason@kernel.org \
--cc=mhocko@suse.com \
--cc=mm-commits@vger.kernel.org \
--cc=pfalcato@suse.de \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=willy@infradead.org \
--cc=xu.xin@linux.dev \
/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 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.