Re: [PATCH 3/3] mm/mseal: remove further superfluous comments, do_mseal()
From: Lorenzo Stoakes (ARM)
Date: Fri Jul 17 2026 - 07:19:57 EST
On Thu, Jul 16, 2026 at 05:33:55PM -0700, Andrew Morton wrote:
> On Thu, 16 Jul 2026 14:43:11 +0100 "Lorenzo Stoakes (ARM)" <ljs@xxxxxxxxxx> wrote:
>
> > There's no need to abstract do_mseal() any longer so put the system call
> > implementation in the system call declaration.
> >
> > The comment around do_mseal() is strangely formatted, overly long and adds
> > a lot of superfluous information that the code already provides, so boil it
> > down to the essentials.
> >
>
> This patch
> (https://lore.kernel.org/20260716-mseal-fixups-v1-3-3a9609bf041b@xxxxxxxxxx)
> overlaps muchly with Leon's "mm/mseal: fix mseal documentation for
> 32-bit kernels"
> (https://lore.kernel.org/20260715131258.55499-1-leon.hwang@xxxxxxxxx).
>
> I'll remove the mseal.c changes from Leon's patch and I'll retain the
> rest of that patch, after adjusting its changelog. Please check all of
> this!
Thanks! And sorry Leon - we definitely don't need the majority of the
comments in mseal.c - so this change essentially makes those changes of
yours unnecessary here.
>
>
> Here's what's left of Leon's patch:
>
> From: Leon Hwang <leon.hwang@xxxxxxxxx>
> Subject: mm/mseal: fix mseal documentation for 32-bit kernels
> Date: Wed, 15 Jul 2026 21:12:58 +0800
>
> mseal.o is built only for 64-bit kernels, so 32-bit kernels fall back to
> sys_ni_syscall() and return -ENOSYS rather than -EPERM.
>
> Drop architecture description in mseal.rst, since the arch feature doc has
> the latest state of mseal for each architecture.
>
> Fix the CONFIG_MSEAL_SYSTEM_MAPPINGS typo in init/Kconfig.
>
> Link: https://lore.kernel.org/20260715131258.55499-1-leon.hwang@xxxxxxxxx
> Signed-off-by: Leon Hwang <leon.hwang@xxxxxxxxx>
> Acked-by: Lance Yang <lance.yang@xxxxxxxxx>
> Cc: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> Cc: Anand Moon <linux.amoon@xxxxxxxxx>
> Cc: Doug Anderson <dianders@xxxxxxxxxxxx>
> Cc: Gary Guo <gary@xxxxxxxxxxx>
> Cc: Jann Horn <jannh@xxxxxxxxxx>
> Cc: Jonathan Corbet <corbet@xxxxxxx>
> Cc: Leon Hwang <leon.hwang@xxxxxxxxx>
> Cc: Liam R. Howlett <liam@xxxxxxxxxxxxx>
> Cc: Lorenzo Stoakes <ljs@xxxxxxxxxx>
> Cc: Miguel Ojeda <ojeda@xxxxxxxxxx>
> Cc: Nathan Chancellor <nathan@xxxxxxxxxx>
> Cc: Pedro Falcato <pfalcato@xxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> Cc: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> Cc: Vlastimil Babka <vbabka@xxxxxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> ---
>
> Documentation/userspace-api/mseal.rst | 14 ++++++--------
> init/Kconfig | 2 +-
> 2 files changed, 7 insertions(+), 9 deletions(-)
>
> --- a/Documentation/userspace-api/mseal.rst~mm-mseal-fix-mseal-documentation-for-32-bit-kernels
> +++ a/Documentation/userspace-api/mseal.rst
> @@ -50,8 +50,8 @@ mseal syscall signature
> * The start address (``addr``) is not allocated.
> * The end address (``addr`` + ``len``) is not allocated.
> * A gap (unallocated memory) between start and end address.
> - - **-EPERM**:
> - * sealing is supported only on 64-bit CPUs, 32-bit is not supported.
> + - **-ENOSYS**:
> + * The kernel does not implement ``mseal()``.
>
> **Note about error return**:
> - For above error cases, users can expect the given memory range is
> @@ -62,7 +62,8 @@ mseal syscall signature
> memory range could happen. However, those cases should be rare.
>
> **Architecture support**:
> - mseal only works on 64-bit CPUs, not 32-bit CPUs.
> + mseal is built only for 64-bit kernels. 32-bit kernels return
> + ``-ENOSYS``.
>
> **Idempotent**:
> users can call mseal multiple times. mseal on an already sealed memory
> @@ -131,11 +132,11 @@ Use cases
> - Chrome browser: protect some security sensitive data structures.
>
> - System mappings:
> - The system mappings are created by the kernel and includes vdso, vvar,
> + The system mappings are created by the kernel and include vdso, vvar,
> vvar_vclock, vectors (arm compat-mode), sigpage (arm compat-mode), uprobes.
>
> Those system mappings are readonly only or execute only, memory sealing can
> - protect them from ever changing to writable or unmmap/remapped as different
> + protect them from ever changing to writable or unmapped/remapped as different
> attributes. This is useful to mitigate memory corruption issues where a
> corrupted pointer is passed to a memory management system.
>
> @@ -143,9 +144,6 @@ Use cases
> the CONFIG_MSEAL_SYSTEM_MAPPINGS seals all system mappings of this
> architecture.
>
> - The following architectures currently support this feature: x86-64, arm64,
> - loongarch and s390.
> -
> WARNING: This feature breaks programs which rely on relocating
> or unmapping system mappings. Known broken software at the time
> of writing includes CHECKPOINT_RESTORE, UML, gVisor, rr. Therefore
> --- a/init/Kconfig~mm-mseal-fix-mseal-documentation-for-32-bit-kernels
> +++ a/init/Kconfig
> @@ -2120,7 +2120,7 @@ config ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPIN
> from a kernel perspective.
>
> After the architecture enables this, a distribution can set
> - CONFIG_MSEAL_SYSTEM_MAPPING to manage access to the feature.
> + CONFIG_MSEAL_SYSTEM_MAPPINGS to manage access to the feature.
>
> For complete descriptions of memory sealing, please see
> Documentation/userspace-api/mseal.rst
> _
>
LGTM!
Cheers, Lorenzo