From: Andrew Morton <akpm@linux-foundation.org>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: "Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>, Jann Horn <jannh@google.com>,
Pedro Falcato <pfalcato@suse.de>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Kees Cook <kees@kernel.org>, David Hildenbrand <david@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 0/3] mm/mseal: further cleanups
Date: Fri, 17 Jul 2026 12:39:58 -0700 [thread overview]
Message-ID: <20260717123958.98f965ed7996804e6157b399@linux-foundation.org> (raw)
In-Reply-To: <20260717-mseal-fixups-v2-0-0daa0014b813@kernel.org>
On Fri, 17 Jul 2026 18:27:08 +0100 "Lorenzo Stoakes (ARM)" <ljs@kernel.org> wrote:
>
> The mseal implementation is still rather confusing, so tighten things up a
> little.
>
> The only user of do_mseal() outside of the system call is the MMAP_PAGE_ZERO
> process personality - retain better control over how mseal is utilised by
> providing mseal_mmap_page_zero() for this instead.
>
> The comments are overly long and confusion, so cut them down so they're a lot
> clearer.
>
> Remove confusing mm_struct params (mseal can not be used on remote mm's) and
> wrap the actual system call logic into the system call declaration.
Thanks, I've updated mm-new to this version.
> v2:
> * Added tags (thanks everyone!)
> * Abstracted mm as per David.
> * Renamed [__]mseal() to [__]mseal_range() as per Pedro.
> * Moved to reverse xmas tree declarations.
> * Tweaked commit message for 2/3.
Here's how v2 altered mm.git:
mm/mseal.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/mm/mseal.c~b
+++ a/mm/mseal.c
@@ -18,9 +18,9 @@
static bool range_contains_unmapped(unsigned long start, unsigned long end)
{
- struct vm_area_struct *vma;
- unsigned long prev_end = start;
VMA_ITERATOR(vmi, current->mm, start);
+ unsigned long prev_end = start;
+ struct vm_area_struct *vma;
for_each_vma_range(vmi, vma, end) {
if (vma->vm_start > prev_end)
@@ -32,10 +32,10 @@ static bool range_contains_unmapped(unsi
return prev_end < end;
}
-static int __mseal(unsigned long start, unsigned long end)
+static int __mseal_range(unsigned long start, unsigned long end)
{
- struct vm_area_struct *vma, *prev;
VMA_ITERATOR(vmi, current->mm, start);
+ struct vm_area_struct *vma, *prev;
/* We know there are no gaps so this will be non-NULL. */
vma = vma_iter_load(&vmi);
@@ -66,7 +66,7 @@ static int __mseal(unsigned long start,
return 0;
}
-static int mseal(unsigned long start, unsigned long end)
+static int mseal_range(unsigned long start, unsigned long end)
{
int err;
@@ -76,7 +76,7 @@ static int mseal(unsigned long start, un
if (range_contains_unmapped(start, end))
err = -ENOMEM;
else
- err = __mseal(start, end);
+ err = __mseal_range(start, end);
mmap_write_unlock(current->mm);
return err;
}
@@ -92,7 +92,7 @@ void mseal_mmap_page_zero(void)
if (WARN_ON_ONCE(!(current->personality & MMAP_PAGE_ZERO)))
return;
- err = mseal(0, PAGE_SIZE);
+ err = mseal_range(0, PAGE_SIZE);
if (err)
pr_warn_ratelimited("pid=%d, couldn't seal address 0, ret=%d.\n",
task_pid_nr(current), err);
@@ -139,5 +139,5 @@ SYSCALL_DEFINE3(mseal, unsigned long, st
if (end == start)
return 0;
- return mseal(start, end);
+ return mseal_range(start, end);
}
_
prev parent reply other threads:[~2026-07-17 19:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 17:27 Lorenzo Stoakes (ARM)
2026-07-17 17:27 ` [PATCH v2 1/3] mm/mseal: remove superfluous comments, fix confusion around mm Lorenzo Stoakes (ARM)
2026-07-17 17:27 ` [PATCH v2 2/3] mm/mseal: limit scope of mseal address zero to address zero Lorenzo Stoakes (ARM)
2026-07-17 17:27 ` [PATCH v2 3/3] mm/mseal: remove further superfluous comments, do_mseal() Lorenzo Stoakes (ARM)
2026-07-17 19:39 ` Andrew Morton [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=20260717123958.98f965ed7996804e6157b399@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=david@kernel.org \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=kees@kernel.org \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=pfalcato@suse.de \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--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