[PATCH] mseal sysmap: enable mips with LOONGSON64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
Tested-by: WangYuli <wangyuli@xxxxxxxxxxxxx>
Signed-off-by: WangYuli <wangyuli@xxxxxxxxxxxxx>
---
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





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux