[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <7EB087B72C4FBDD3+20250417132410.404043-1-wangyuli@uniontech.com>
Date: Thu, 17 Apr 2025 21:24:10 +0800
From: WangYuli <wangyuli@...ontech.com>
To: corbet@....net,
tsbogend@...ha.franken.de
Cc: akpm@...ux-foundation.org,
jeffxu@...omium.org,
lorenzo.stoakes@...cle.com,
kees@...nel.org,
Liam.Howlett@...cle.com,
wangyuli@...ontech.com,
hca@...ux.ibm.com,
takumaw1990@...il.com,
linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org,
thomas.weissschuh@...utronix.de,
tglx@...utronix.de,
namcao@...utronix.de,
zhanjun@...ontech.com,
niecheng1@...ontech.com,
guanwentao@...ontech.com,
Erpeng Xu <xuerpeng@...ontech.com>
Subject: [PATCH] mseal sysmap: enable mips with LOONGSON64
Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on mips with
CPU_LOONGSON64, covering the vdso.
NOTE:
There is significant diversity among devices within the MIPS
architecture, which extends to their kernel code implementations.
My testing capabilities are limited to Loongson 3A4000/3B4000
CPUs.
Consequently, I have not enabled mseal sysmap support for the
entirety of mips64, as I lack the necessary devices for testing.
Tested-by: Erpeng Xu <xuerpeng@...ontech.com>
Tested-by: WangYuli <wangyuli@...ontech.com>
Signed-off-by: WangYuli <wangyuli@...ontech.com>
---
NOTE:
1. As I am unaware whether other 64-bit MIPS devices function
properly, I have not yet modified the MIPS status in
mseal_sys_mappings/arch-support.txt.
2. From my perspective, it appears that this architecture also
does not rely on remapping the VDSO, VVAR, or any other special
mapping. Nevertheless, I believe it would be best to get further
confirmation from more expert individuals such as Lorenzo Stoakes
and Thomas Bogendoerfer.
---
Documentation/userspace-api/mseal.rst | 2 +-
arch/mips/Kconfig | 1 +
arch/mips/kernel/vdso.c | 3 ++-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/userspace-api/mseal.rst b/Documentation/userspace-api/mseal.rst
index ea9b11a0bd89..968a6db8afb7 100644
--- a/Documentation/userspace-api/mseal.rst
+++ b/Documentation/userspace-api/mseal.rst
@@ -144,7 +144,7 @@ Use cases
architecture.
The following architectures currently support this feature: x86-64, arm64,
- loongarch and s390.
+ loongarch, mips64el (loongson3) and s390.
WARNING: This feature breaks programs which rely on relocating
or unmapping system mappings. Known broken software at the time
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index fc0772c1bad4..055a185deb07 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -25,6 +25,7 @@ config MIPS
select ARCH_USE_QUEUED_RWLOCKS
select ARCH_USE_QUEUED_SPINLOCKS
select ARCH_SUPPORTS_HUGETLBFS if CPU_SUPPORTS_HUGEPAGES
+ select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS if CPU_LOONGSON64
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
select ARCH_WANT_IPC_PARSE_VERSION
select ARCH_WANT_LD_ORPHAN_WARN
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
index de096777172f..6221f2dcedb1 100644
--- a/arch/mips/kernel/vdso.c
+++ b/arch/mips/kernel/vdso.c
@@ -167,7 +167,8 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
/* Map VDSO image. */
vma = _install_special_mapping(mm, vdso_addr, image->size,
VM_READ | VM_EXEC |
- VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
+ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |
+ VM_SEALED_SYSMAP,
&image->mapping);
if (IS_ERR(vma)) {
ret = PTR_ERR(vma);
--
2.49.0
Powered by blists - more mailing lists