From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7BA3C43458 for ; Fri, 3 Jul 2026 02:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+oeutWVz4x7NYJ3eOAsl8Qoc/6HDqrOissgcnDAZQu8=; b=vXmCkVMq5Qxbh0 JOQWWloyq6Q5EXR1+IWB3sF2STMSv49qDdoaVSjhHUIw8kiEERsybdK/GO6Mjvdp8BFmQb9JrezV5 HMjF7Fk1l56lzBs/KqSNNFZlR23+OoAwWY3RY1zLiXZSie4ETLZXKso5QN/a5cyjcuHURRQLIR3t9 f3B88G+DHa1b1sCkTjki5zS3HvSVWAVN7Anpd86xkplnZSC2AoqvyYspALFWvDbzmcrwRtAtfSN36 cPNzc55kpcBTZTsTisEI0ogwsJBxEv/hD8EkIUUEmCtcxDcdTwd/HLWejZsntOxiDOCl/5ejCceCK JUKPgpvySx/vOBi16muQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wfTbp-00000005spA-3Wz6; Fri, 03 Jul 2026 02:26:29 +0000 Received: from out-183.mta0.migadu.com ([91.218.175.183]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wfTbm-00000005soj-2ke5 for linux-riscv@lists.infradead.org; Fri, 03 Jul 2026 02:26:28 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783045581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZI0lTmkO/UHIT4+QlSIiK8ejRok32RfZUe5uhwcA5/U=; b=HAOh61zc+mozxiYtcPNEO5Yx8iORG5T8Mkpg/vMHNt2052hHUqbiQmAarZ6Dw+Wa155V9M 3s5333q3wzpR9SONk7wmKAVZRq1Oa6jrucylyEZauSAr7GDU5Puc5fP1m+9Lie//AcBW+2 G42rxvyD2sX024RzcWXP/b0U8+rU9uQ= From: Leon Hwang To: linux-mm@kvack.org Subject: [PATCH] mm/mseal: fix mseal documentation for 32-bit kernels Date: Fri, 3 Jul 2026 10:25:07 +0800 Message-ID: <20260703022507.187457-1-leon.hwang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260702_192627_066899_366514BA X-CRM114-Status: GOOD ( 16.94 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, Peter Zijlstra , linux-kernel@vger.kernel.org, "Liam R . Howlett" , Gary Guo , linux-riscv@lists.infradead.org, Vlastimil Babka , Alexandre Ghiti , Jonathan Corbet , Alice Ryhl , Miguel Ojeda , Leon Hwang , Albert Ou , Jann Horn , Nathan Chancellor , Shuah Khan , Pedro Falcato , Lorenzo Stoakes , Andrew Morton , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Nicolas Schier , Randy Dunlap , Douglas Anderson , Palmer Dabbelt , Thomas Gleixner , Paul Walmsley Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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. Document the -EINTR return from mmap_write_lock_killable(), fix the CONFIG_MSEAL_SYSTEM_MAPPINGS typo, and describe system mappings in terms of VM_SEALED_SYSMAP. Signed-off-by: Leon Hwang --- Documentation/userspace-api/mseal.rst | 18 ++++++++++-------- init/Kconfig | 2 +- mm/mseal.c | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Documentation/userspace-api/mseal.rst b/Documentation/userspace-api/mseal.rst index ea9b11a0bd89..1f1cf206670c 100644 --- a/Documentation/userspace-api/mseal.rst +++ b/Documentation/userspace-api/mseal.rst @@ -50,8 +50,10 @@ 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. + - **-EINTR**: + * Interrupted while waiting for the mmap write lock. + - **-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 +64,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,20 +134,19 @@ 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. If supported by an architecture (CONFIG_ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS), - the CONFIG_MSEAL_SYSTEM_MAPPINGS seals all system mappings of this - architecture. + CONFIG_MSEAL_SYSTEM_MAPPINGS seals mappings marked with VM_SEALED_SYSMAP. The following architectures currently support this feature: x86-64, arm64, - loongarch and s390. + loongarch, riscv, and s390. WARNING: This feature breaks programs which rely on relocating or unmapping system mappings. Known broken software at the time diff --git a/init/Kconfig b/init/Kconfig index 5230d4879b1c..12bb39f637b1 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -2112,7 +2112,7 @@ config ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS 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 diff --git a/mm/mseal.c b/mm/mseal.c index 9781647483d1..0464c7b94ab9 100644 --- a/mm/mseal.c +++ b/mm/mseal.c @@ -132,8 +132,8 @@ static int mseal_apply(struct mm_struct *mm, * addr is not a valid address (not allocated). * end (start + len) is not a valid address. * a gap (unallocated memory) between start and end. - * -EPERM: - * - In 32 bit architecture, sealing is not supported. + * -EINTR: + * interrupted while waiting for the mmap write lock. * Note: * user can call mseal(2) multiple times, adding a seal on an * already sealed memory is a no-action (no error). -- 2.54.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv