From: WangYuli <wangyuli@uniontech.com>
To: corbet@lwn.net, tsbogend@alpha.franken.de
Cc: akpm@linux-foundation.org, jeffxu@chromium.org,
lorenzo.stoakes@oracle.com, kees@kernel.org,
Liam.Howlett@oracle.com, wangyuli@uniontech.com,
hca@linux.ibm.com, takumaw1990@gmail.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mips@vger.kernel.org, thomas.weissschuh@linutronix.de,
tglx@linutronix.de, namcao@linutronix.de, zhanjun@uniontech.com,
niecheng1@uniontech.com, guanwentao@uniontech.com,
Erpeng Xu <xuerpeng@uniontech.com>
Subject: [PATCH] mseal sysmap: enable mips with LOONGSON64
Date: Thu, 17 Apr 2025 21:24:10 +0800 [thread overview]
Message-ID: <7EB087B72C4FBDD3+20250417132410.404043-1-wangyuli@uniontech.com> (raw)
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@uniontech.com>
Tested-by: WangYuli <wangyuli@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.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
next reply other threads:[~2025-04-17 13:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 13:24 WangYuli [this message]
2025-04-17 14:27 ` Pedro Falcato
2025-04-17 14:50 ` 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=7EB087B72C4FBDD3+20250417132410.404043-1-wangyuli@uniontech.com \
--to=wangyuli@uniontech.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=guanwentao@uniontech.com \
--cc=hca@linux.ibm.com \
--cc=jeffxu@chromium.org \
--cc=kees@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=namcao@linutronix.de \
--cc=niecheng1@uniontech.com \
--cc=takumaw1990@gmail.com \
--cc=tglx@linutronix.de \
--cc=thomas.weissschuh@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=xuerpeng@uniontech.com \
--cc=zhanjun@uniontech.com \
/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
all inboxes | Powered by JetHome®