Re: [PATCH] mseal sysmap: enable LoongArch
From: Lorenzo Stoakes
Date: Tue Apr 15 2025 - 10:02:34 EST
On Tue, Apr 15, 2025 at 09:49:33PM +0800, WangYuli wrote:
> Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on LoongArch,
> covering the vdso.
>
> Tested-by: Yuli Wang <wangyuli@xxxxxxxxxxxxx>
> Signed-off-by: Yuli Wang <wangyuli@xxxxxxxxxxxxx>
I'm sure it's fine, but I am yet to encounter somebody enabling this for an
arch and saying 'I have checked to ensure we in no way rely on remapping
the VDSO, VVAR or any other special mapping'.
Because if you haven't, doing this breaks your arch.
I hate to sound like a grumpy maintainer, but could I just ask to check
whether you have, indeed, confirmed this? :)
If so then all good.
I also think we have a table somewhere in a doc that needs updating then?
Jeff, can you confirm?
Thanks!
> ---
> Documentation/userspace-api/mseal.rst | 2 +-
> arch/loongarch/Kconfig | 1 +
> arch/loongarch/kernel/vdso.c | 4 +++-
> 3 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/userspace-api/mseal.rst b/Documentation/userspace-api/mseal.rst
> index 1dabfc29be0d..ef733f69003d 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,
> - and s390.
> + loongarch 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/loongarch/Kconfig b/arch/loongarch/Kconfig
> index 067c0b994648..54ed5b59a690 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -69,6 +69,7 @@ config LOONGARCH
> select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
> select ARCH_SUPPORTS_LTO_CLANG
> select ARCH_SUPPORTS_LTO_CLANG_THIN
> + select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
> select ARCH_SUPPORTS_NUMA_BALANCING
> select ARCH_SUPPORTS_RT
> select ARCH_USE_BUILTIN_BSWAP
> diff --git a/arch/loongarch/kernel/vdso.c b/arch/loongarch/kernel/vdso.c
> index 10cf1608c7b3..7b888d9085a0 100644
> --- a/arch/loongarch/kernel/vdso.c
> +++ b/arch/loongarch/kernel/vdso.c
> @@ -105,7 +105,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
>
> vdso_addr = data_addr + VVAR_SIZE;
> vma = _install_special_mapping(mm, vdso_addr, info->size,
> - VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
> + VM_READ | VM_EXEC |
> + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |
> + VM_SEALED_SYSMAP,
> &info->code_mapping);
> if (IS_ERR(vma)) {
> ret = PTR_ERR(vma);
> --
> 2.49.0
>