Re: [PATCH v7 5/7] mseal, system mappings: enable uml architecture
From: Lorenzo Stoakes
Date: Tue Feb 25 2025 - 01:23:17 EST
On Mon, Feb 24, 2025 at 10:52:44PM +0000, jeffxu@xxxxxxxxxxxx wrote:
> From: Jeff Xu <jeffxu@xxxxxxxxxxxx>
>
> Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on UML, covering
> the vdso.
>
> Testing passes on UML.
Maybe expand on this by stating that it has been confirmed by Benjamin (I
_believe_) that UML has no need for problematic relocation so this is known to
be good.
>
> Signed-off-by: Jeff Xu <jeffxu@xxxxxxxxxxxx>
> Tested-by: Benjamin Berg <benjamin.berg@xxxxxxxxx>
Anyway I know UML has at any rate been confirmed to be good to go + patch looks
fine, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> ---
> arch/um/Kconfig | 1 +
> arch/x86/um/vdso/vma.c | 6 ++++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> index 18051b1cfce0..eb2d439a5334 100644
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -10,6 +10,7 @@ config UML
> select ARCH_HAS_FORTIFY_SOURCE
> select ARCH_HAS_GCOV_PROFILE_ALL
> select ARCH_HAS_KCOV
> + select ARCH_HAS_MSEAL_SYSTEM_MAPPINGS
> select ARCH_HAS_STRNCPY_FROM_USER
> select ARCH_HAS_STRNLEN_USER
> select HAVE_ARCH_AUDITSYSCALL
> diff --git a/arch/x86/um/vdso/vma.c b/arch/x86/um/vdso/vma.c
> index f238f7b33cdd..fdfba858ffc9 100644
> --- a/arch/x86/um/vdso/vma.c
> +++ b/arch/x86/um/vdso/vma.c
> @@ -54,6 +54,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
> {
> struct vm_area_struct *vma;
> struct mm_struct *mm = current->mm;
> + unsigned long vm_flags;
> static struct vm_special_mapping vdso_mapping = {
> .name = "[vdso]",
> };
> @@ -65,9 +66,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
> return -EINTR;
>
> vdso_mapping.pages = vdsop;
> + vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC;
> + vm_flags |= VM_SEALED_SYSMAP;
> vma = _install_special_mapping(mm, um_vdso_addr, PAGE_SIZE,
> - VM_READ|VM_EXEC|
> - VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
> + vm_flags,
> &vdso_mapping);
>
> mmap_write_unlock(mm);
> --
> 2.48.1.658.g4767266eb4-goog
>