diff mbox series

[mm-unstable,2/2] mseal sysmap: enable s390

Message ID 20250311123326.2686682-3-hca@linux.ibm.com (mailing list archive)
State New
Headers show
Series mseal system mappings fix + s390 enablement | expand

Commit Message

Heiko Carstens March 11, 2025, 12:33 p.m. UTC
Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on s390, covering the
vdso.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/s390/Kconfig       | 1 +
 arch/s390/kernel/vdso.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Lorenzo Stoakes March 11, 2025, 2:37 p.m. UTC | #1
On Tue, Mar 11, 2025 at 01:33:26PM +0100, Heiko Carstens wrote:
> Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on s390, covering the
> vdso.
>
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
>  arch/s390/Kconfig       | 1 +
>  arch/s390/kernel/vdso.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index 608a965e2344..93b880992596 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -141,6 +141,7 @@ config S390
>  	select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>  	select ARCH_SUPPORTS_HUGETLBFS
>  	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && CC_IS_CLANG
> +	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS

As discussed in 0/2, s390 does not rely on remapping system mappings in any
kind of bizarre way so this is all good.

>  	select ARCH_SUPPORTS_NUMA_BALANCING
>  	select ARCH_SUPPORTS_PER_VMA_LOCK
>  	select ARCH_USE_BUILTIN_BSWAP
> diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
> index 70c8f9ad13cd..430feb1a5013 100644
> --- a/arch/s390/kernel/vdso.c
> +++ b/arch/s390/kernel/vdso.c
> @@ -80,7 +80,7 @@ static int map_vdso(unsigned long addr, unsigned long vdso_mapping_len)
>  	vdso_text_start = vvar_start + VDSO_NR_PAGES * PAGE_SIZE;
>  	/* VM_MAYWRITE for COW so gdb can set breakpoints */
>  	vma = _install_special_mapping(mm, vdso_text_start, vdso_text_len,
> -				       VM_READ|VM_EXEC|
> +				       VM_READ|VM_EXEC|VM_SEALED_SYSMAP|
>  				       VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
>  				       vdso_mapping);
>  	if (IS_ERR(vma)) {
> --
> 2.45.2
>
Jeff Xu March 11, 2025, 9:55 p.m. UTC | #2
On Tue, Mar 11, 2025 at 5:33 AM Heiko Carstens <hca@linux.ibm.com> wrote:
>
> Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on s390, covering the
> vdso.
>
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> ---
>  arch/s390/Kconfig       | 1 +
>  arch/s390/kernel/vdso.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index 608a965e2344..93b880992596 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -141,6 +141,7 @@ config S390
>         select ARCH_SUPPORTS_DEBUG_PAGEALLOC
>         select ARCH_SUPPORTS_HUGETLBFS
>         select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && CC_IS_CLANG
> +       select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
>         select ARCH_SUPPORTS_NUMA_BALANCING
>         select ARCH_SUPPORTS_PER_VMA_LOCK
>         select ARCH_USE_BUILTIN_BSWAP
> diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
> index 70c8f9ad13cd..430feb1a5013 100644
> --- a/arch/s390/kernel/vdso.c
> +++ b/arch/s390/kernel/vdso.c
> @@ -80,7 +80,7 @@ static int map_vdso(unsigned long addr, unsigned long vdso_mapping_len)
>         vdso_text_start = vvar_start + VDSO_NR_PAGES * PAGE_SIZE;
>         /* VM_MAYWRITE for COW so gdb can set breakpoints */
>         vma = _install_special_mapping(mm, vdso_text_start, vdso_text_len,
> -                                      VM_READ|VM_EXEC|
> +                                      VM_READ|VM_EXEC|VM_SEALED_SYSMAP|
>                                        VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
>                                        vdso_mapping);
>         if (IS_ERR(vma)) {
> --
> 2.45.2
>
Great ! one more architecture uses this feature.

Reviewed-by: Jeff Xu <jeffxu@chromium.org>
Jeff Xu March 11, 2025, 10:12 p.m. UTC | #3
One more thing: do you want to update mseal.rst to add s390 as
supported architecture?

Currently in the mseal.rst:
 "The following architectures currently support this feature: x86-64 and arm64."

Thanks
-Jeff

On Tue, Mar 11, 2025 at 2:55 PM Jeff Xu <jeffxu@chromium.org> wrote:
>
> On Tue, Mar 11, 2025 at 5:33 AM Heiko Carstens <hca@linux.ibm.com> wrote:
> >
> > Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on s390, covering the
> > vdso.
> >
> > Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> > ---
> >  arch/s390/Kconfig       | 1 +
> >  arch/s390/kernel/vdso.c | 2 +-
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> > index 608a965e2344..93b880992596 100644
> > --- a/arch/s390/Kconfig
> > +++ b/arch/s390/Kconfig
> > @@ -141,6 +141,7 @@ config S390
> >         select ARCH_SUPPORTS_DEBUG_PAGEALLOC
> >         select ARCH_SUPPORTS_HUGETLBFS
> >         select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && CC_IS_CLANG
> > +       select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
> >         select ARCH_SUPPORTS_NUMA_BALANCING
> >         select ARCH_SUPPORTS_PER_VMA_LOCK
> >         select ARCH_USE_BUILTIN_BSWAP
> > diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
> > index 70c8f9ad13cd..430feb1a5013 100644
> > --- a/arch/s390/kernel/vdso.c
> > +++ b/arch/s390/kernel/vdso.c
> > @@ -80,7 +80,7 @@ static int map_vdso(unsigned long addr, unsigned long vdso_mapping_len)
> >         vdso_text_start = vvar_start + VDSO_NR_PAGES * PAGE_SIZE;
> >         /* VM_MAYWRITE for COW so gdb can set breakpoints */
> >         vma = _install_special_mapping(mm, vdso_text_start, vdso_text_len,
> > -                                      VM_READ|VM_EXEC|
> > +                                      VM_READ|VM_EXEC|VM_SEALED_SYSMAP|
> >                                        VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
> >                                        vdso_mapping);
> >         if (IS_ERR(vma)) {
> > --
> > 2.45.2
> >
> Great ! one more architecture uses this feature.
>
> Reviewed-by: Jeff Xu <jeffxu@chromium.org>
Heiko Carstens March 12, 2025, 3:39 p.m. UTC | #4
On Tue, Mar 11, 2025 at 03:12:55PM -0700, Jeff Xu wrote:
> One more thing: do you want to update mseal.rst to add s390 as
> supported architecture?
> 
> Currently in the mseal.rst:
>  "The following architectures currently support this feature: x86-64 and arm64."

Thanks, I missed that, however I'm wondering if it would make sense to add
mseal to the generic feature list instead (no, I am not volunteering to do
that :) ).

See Documentation/features/... and scripts/get_feat.pl
diff mbox series

Patch

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 608a965e2344..93b880992596 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -141,6 +141,7 @@  config S390
 	select ARCH_SUPPORTS_DEBUG_PAGEALLOC
 	select ARCH_SUPPORTS_HUGETLBFS
 	select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && CC_IS_CLANG
+	select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
 	select ARCH_SUPPORTS_NUMA_BALANCING
 	select ARCH_SUPPORTS_PER_VMA_LOCK
 	select ARCH_USE_BUILTIN_BSWAP
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index 70c8f9ad13cd..430feb1a5013 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -80,7 +80,7 @@  static int map_vdso(unsigned long addr, unsigned long vdso_mapping_len)
 	vdso_text_start = vvar_start + VDSO_NR_PAGES * PAGE_SIZE;
 	/* VM_MAYWRITE for COW so gdb can set breakpoints */
 	vma = _install_special_mapping(mm, vdso_text_start, vdso_text_len,
-				       VM_READ|VM_EXEC|
+				       VM_READ|VM_EXEC|VM_SEALED_SYSMAP|
 				       VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
 				       vdso_mapping);
 	if (IS_ERR(vma)) {