From: Hajime Tazaki <thehajime@gmail.com>
To: akpm@linux-foundation.org
Cc: liam@infradead.org, ljs@kernel.org, vbabka@kernel.org,
jannh@google.com, pfalcato@suse.de, linux-mm@kvack.org,
geert@linux-m68k.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: nommu: free unused resources when mremap shrinks the vma
Date: Sat, 11 Jul 2026 12:03:35 +0900 [thread overview]
Message-ID: <m18q7i9qig.wl-thehajime@gmail.com> (raw)
In-Reply-To: <20260710174340.9f3b420629769b556f44640f@linux-foundation.org>
On Sat, 11 Jul 2026 09:43:40 +0900,
Andrew Morton wrote:
>
> On Fri, 10 Jul 2026 11:10:28 +0900 Hajime Tazaki <thehajime@gmail.com> wrote:
>
> > When shrinking a VMA via mremap, the bounds are modified directly:
> > mm/nommu.c:do_mremap() {
> > ...
> > vma->vm_end = vma->vm_start + new_len;
> > ...
> > }
> > This shrink the VMA without updating its bounds in the maple tree.
> > If the maple tree (mm->mm_mt) still contains the old bounds, a user
> > process could access the freed portion. The stale maple tree would
> > incorrectly return the shrunk VMA for an address past its new vm_end.
> >
> > This commit fixes this issue by calling vmi_shrink_vma() when shrink
> > happens.
>
> Thanks again for helping with NOMMU. I'd like to give you a medal, but
> you'll have to settle for an overstuffed inbox.
thanks for looking at this and sorry for the rush of patches due to my
bad (lack of local sashiko review). I'll try to be calm and find a
local env anyway.
> Sashiko is up to its usual tricks:
> https://sashiko.dev/#/patchset/20260710021028.892645-1-thehajime@gmail.com
thanks, I already posted a v2 patch which addresses this issue (but
found another issue in a different location).
https://lore.kernel.org/linux-mm/20260710054648.924005-1-thehajime@gmail.com/
> I assume that ENOMEM is more likely on NOMMU, and that we should hence be
> more defensive about handling it. Seems we have not been.
I agree.
-- Hajime
prev parent reply other threads:[~2026-07-11 3:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 2:10 [PATCH] mm: nommu: free unused resources when mremap shrinks the vma Hajime Tazaki
2026-07-11 0:43 ` Andrew Morton
2026-07-11 3:03 ` Hajime Tazaki [this message]
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=m18q7i9qig.wl-thehajime@gmail.com \
--to=thehajime@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=pfalcato@suse.de \
--cc=vbabka@kernel.org \
/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