From: Andrew Morton <akpm@linux-foundation.org>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Peter Xu <peterx@redhat.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
Pedro Falcato <pfalcato@suse.de>, Rik van Riel <riel@surriel.com>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: [PATCH v4 06/10] mm/mremap: check remap conditions earlier
Date: Sun, 20 Jul 2025 11:29:14 -0700 [thread overview]
Message-ID: <20250720112914.6692e658f4c5b7f4349214be@linux-foundation.org> (raw)
In-Reply-To: <8fc92a38-c636-465e-9a2f-2c6ac9cb49b8@lucifer.local>
On Sun, 20 Jul 2025 12:04:42 +0100 Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote:
> Hi Andrew,
>
> It turns out there's some undocumented, unusual behaviour in mremap()
> around shrinking of a range which was previously missed, but an LTP test
> flagged up (seemingly by accident).
>
> Basically, if you specify an input range that spans multiple VMAs, this is
> in nearly all cases rejected (this is the point of this series, after all,
> for VMA moves).
>
> However, it turns out if you a. shrink a range and b. the new size spans
> only a single VMA in the original range - then this requirement is entirely
> dropped.
>
> So I need to slightly adjust the logic to account for this. I will also be
> documenting this in the man page as it appears the man page contradicts
> this or is at least very unclear.
>
> I attach a fix-patch, however there's some very trivial conflicts caused
> due to code being moved around.
>
OK, I applied this as a -fix.
Moved the two new hunks into check_prep_vma().
Made sure the "We are expanding and the VMA .." hunk landed properly in
check_prep_vma().
I've pushed out the result, please check current mm-unstable.
next prev parent reply other threads:[~2025-07-20 18:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 16:55 [PATCH v4 00/10] mm/mremap: permit mremap() move of multiple VMAs Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 01/10] mm/mremap: perform some simple cleanups Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 02/10] mm/mremap: refactor initial parameter sanity checks Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 03/10] mm/mremap: put VMA check and prep logic into helper function Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 04/10] mm/mremap: cleanup post-processing stage of mremap Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 05/10] mm/mremap: use an explicit uffd failure path for mremap Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 06/10] mm/mremap: check remap conditions earlier Lorenzo Stoakes
2025-07-20 11:04 ` Lorenzo Stoakes
2025-07-20 18:29 ` Andrew Morton [this message]
2025-07-20 18:52 ` Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 07/10] mm/mremap: move remap_is_valid() into check_prep_vma() Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 08/10] mm/mremap: clean up mlock populate behaviour Lorenzo Stoakes
2025-07-17 16:55 ` [PATCH v4 09/10] mm/mremap: permit mremap() move of multiple VMAs Lorenzo Stoakes
2025-07-17 16:56 ` [PATCH v4 10/10] tools/testing/selftests: extend mremap_test to test multi-VMA mremap Lorenzo Stoakes
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=20250720112914.6692e658f4c5b7f4349214be@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Liam.Howlett@oracle.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=peterx@redhat.com \
--cc=pfalcato@suse.de \
--cc=riel@surriel.com \
--cc=vbabka@suse.cz \
--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