Message ID | 20250303050921.3033083-4-jeffxu@google.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mseal system mappings | expand |
On Mon, Mar 03, 2025 at 05:09:17AM +0000, jeffxu@chromium.org wrote: > From: Jeff Xu <jeffxu@chromium.org> > > Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on x86-64, > covering the vdso, vvar, vvar_vclock. > > Production release testing passes on Android and Chrome OS. > > Signed-off-by: Jeff Xu <jeffxu@chromium.org> LGTM, so: Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> > --- > arch/x86/Kconfig | 1 + > arch/x86/entry/vdso/vma.c | 7 ++++--- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index be2c311f5118..c6f9ebcbe009 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -26,6 +26,7 @@ config X86_64 > depends on 64BIT > # Options that are inherently 64-bit kernel only: > select ARCH_HAS_GIGANTIC_PAGE > + select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS > select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 > select ARCH_SUPPORTS_PER_VMA_LOCK > select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE > diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c > index 39e6efc1a9ca..a4f312495de1 100644 > --- a/arch/x86/entry/vdso/vma.c > +++ b/arch/x86/entry/vdso/vma.c > @@ -268,7 +268,8 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > text_start, > image->size, > VM_READ|VM_EXEC| > - VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, > + VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| > + VM_SEALED_SYSMAP, > &vdso_mapping); > > if (IS_ERR(vma)) { > @@ -280,7 +281,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > addr, > (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, > VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| > - VM_PFNMAP, > + VM_PFNMAP|VM_SEALED_SYSMAP, > &vvar_mapping); > > if (IS_ERR(vma)) { > @@ -293,7 +294,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > addr + (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, > VDSO_NR_VCLOCK_PAGES * PAGE_SIZE, > VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| > - VM_PFNMAP, > + VM_PFNMAP|VM_SEALED_SYSMAP, > &vvar_vclock_mapping); > > if (IS_ERR(vma)) { > -- > 2.48.1.711.g2feabab25a-goog >
I tried b4 shazam'ing this and there's a problem applying the patch, seems maybe a conflict? Not sure if Andrew can resolve or if something needs to be done here? Seems to be commit d77a800944d8 ("mm: make DEBUG_@WX dependent on GENERIC_PTDUMP")? Should be a trivial resolve though. On Mon, Mar 03, 2025 at 05:09:17AM +0000, jeffxu@chromium.org wrote: > From: Jeff Xu <jeffxu@chromium.org> > > Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on x86-64, > covering the vdso, vvar, vvar_vclock. > > Production release testing passes on Android and Chrome OS. > > Signed-off-by: Jeff Xu <jeffxu@chromium.org> > --- > arch/x86/Kconfig | 1 + > arch/x86/entry/vdso/vma.c | 7 ++++--- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index be2c311f5118..c6f9ebcbe009 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -26,6 +26,7 @@ config X86_64 > depends on 64BIT > # Options that are inherently 64-bit kernel only: > select ARCH_HAS_GIGANTIC_PAGE > + select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS > select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 > select ARCH_SUPPORTS_PER_VMA_LOCK > select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE > diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c > index 39e6efc1a9ca..a4f312495de1 100644 > --- a/arch/x86/entry/vdso/vma.c > +++ b/arch/x86/entry/vdso/vma.c > @@ -268,7 +268,8 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > text_start, > image->size, > VM_READ|VM_EXEC| > - VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, > + VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| > + VM_SEALED_SYSMAP, > &vdso_mapping); > > if (IS_ERR(vma)) { > @@ -280,7 +281,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > addr, > (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, > VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| > - VM_PFNMAP, > + VM_PFNMAP|VM_SEALED_SYSMAP, > &vvar_mapping); > > if (IS_ERR(vma)) { > @@ -293,7 +294,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > addr + (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, > VDSO_NR_VCLOCK_PAGES * PAGE_SIZE, > VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| > - VM_PFNMAP, > + VM_PFNMAP|VM_SEALED_SYSMAP, > &vvar_vclock_mapping); > > if (IS_ERR(vma)) { > -- > 2.48.1.711.g2feabab25a-goog >
* jeffxu@chromium.org <jeffxu@chromium.org> [250303 00:09]: > From: Jeff Xu <jeffxu@chromium.org> > > Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on x86-64, > covering the vdso, vvar, vvar_vclock. > > Production release testing passes on Android and Chrome OS. > > Signed-off-by: Jeff Xu <jeffxu@chromium.org> Thanks, this is much cleaner. Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com> > --- > arch/x86/Kconfig | 1 + > arch/x86/entry/vdso/vma.c | 7 ++++--- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index be2c311f5118..c6f9ebcbe009 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -26,6 +26,7 @@ config X86_64 > depends on 64BIT > # Options that are inherently 64-bit kernel only: > select ARCH_HAS_GIGANTIC_PAGE > + select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS > select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 > select ARCH_SUPPORTS_PER_VMA_LOCK > select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE > diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c > index 39e6efc1a9ca..a4f312495de1 100644 > --- a/arch/x86/entry/vdso/vma.c > +++ b/arch/x86/entry/vdso/vma.c > @@ -268,7 +268,8 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > text_start, > image->size, > VM_READ|VM_EXEC| > - VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, > + VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| > + VM_SEALED_SYSMAP, > &vdso_mapping); > > if (IS_ERR(vma)) { > @@ -280,7 +281,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > addr, > (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, > VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| > - VM_PFNMAP, > + VM_PFNMAP|VM_SEALED_SYSMAP, > &vvar_mapping); > > if (IS_ERR(vma)) { > @@ -293,7 +294,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > addr + (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, > VDSO_NR_VCLOCK_PAGES * PAGE_SIZE, > VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| > - VM_PFNMAP, > + VM_PFNMAP|VM_SEALED_SYSMAP, > &vvar_vclock_mapping); > > if (IS_ERR(vma)) { > -- > 2.48.1.711.g2feabab25a-goog >
On Mon, Mar 03, 2025 at 05:09:17AM +0000, jeffxu@chromium.org wrote: > From: Jeff Xu <jeffxu@chromium.org> > > Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on x86-64, > covering the vdso, vvar, vvar_vclock. > > Production release testing passes on Android and Chrome OS. > > Signed-off-by: Jeff Xu <jeffxu@chromium.org> Short and to the point. :) Reviewed-by: Kees Cook <kees@kernel.org>
On Mon, Mar 3, 2025 at 4:01 AM Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote: > > I tried b4 shazam'ing this and there's a problem applying the patch, seems > maybe a conflict? > > Not sure if Andrew can resolve or if something needs to be done here? > > Seems to be commit d77a800944d8 ("mm: make DEBUG_@WX dependent on > GENERIC_PTDUMP")? > > Should be a trivial resolve though. > This version is based on linux-main, if that helps resolving the conflict. I can also rebase using the mm-(unstable/stable) branch or other branches if asked. Thanks -Jeff > On Mon, Mar 03, 2025 at 05:09:17AM +0000, jeffxu@chromium.org wrote: > > From: Jeff Xu <jeffxu@chromium.org> > > > > Provide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on x86-64, > > covering the vdso, vvar, vvar_vclock. > > > > Production release testing passes on Android and Chrome OS. > > > > Signed-off-by: Jeff Xu <jeffxu@chromium.org> > > --- > > arch/x86/Kconfig | 1 + > > arch/x86/entry/vdso/vma.c | 7 ++++--- > > 2 files changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > index be2c311f5118..c6f9ebcbe009 100644 > > --- a/arch/x86/Kconfig > > +++ b/arch/x86/Kconfig > > @@ -26,6 +26,7 @@ config X86_64 > > depends on 64BIT > > # Options that are inherently 64-bit kernel only: > > select ARCH_HAS_GIGANTIC_PAGE > > + select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS > > select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 > > select ARCH_SUPPORTS_PER_VMA_LOCK > > select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE > > diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c > > index 39e6efc1a9ca..a4f312495de1 100644 > > --- a/arch/x86/entry/vdso/vma.c > > +++ b/arch/x86/entry/vdso/vma.c > > @@ -268,7 +268,8 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > > text_start, > > image->size, > > VM_READ|VM_EXEC| > > - VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, > > + VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| > > + VM_SEALED_SYSMAP, > > &vdso_mapping); > > > > if (IS_ERR(vma)) { > > @@ -280,7 +281,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > > addr, > > (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, > > VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| > > - VM_PFNMAP, > > + VM_PFNMAP|VM_SEALED_SYSMAP, > > &vvar_mapping); > > > > if (IS_ERR(vma)) { > > @@ -293,7 +294,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) > > addr + (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, > > VDSO_NR_VCLOCK_PAGES * PAGE_SIZE, > > VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| > > - VM_PFNMAP, > > + VM_PFNMAP|VM_SEALED_SYSMAP, > > &vvar_vclock_mapping); > > > > if (IS_ERR(vma)) { > > -- > > 2.48.1.711.g2feabab25a-goog > >
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index be2c311f5118..c6f9ebcbe009 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -26,6 +26,7 @@ config X86_64 depends on 64BIT # Options that are inherently 64-bit kernel only: select ARCH_HAS_GIGANTIC_PAGE + select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 select ARCH_SUPPORTS_PER_VMA_LOCK select ARCH_SUPPORTS_HUGE_PFNMAP if TRANSPARENT_HUGEPAGE diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 39e6efc1a9ca..a4f312495de1 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -268,7 +268,8 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) text_start, image->size, VM_READ|VM_EXEC| - VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, + VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC| + VM_SEALED_SYSMAP, &vdso_mapping); if (IS_ERR(vma)) { @@ -280,7 +281,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) addr, (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| - VM_PFNMAP, + VM_PFNMAP|VM_SEALED_SYSMAP, &vvar_mapping); if (IS_ERR(vma)) { @@ -293,7 +294,7 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) addr + (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE, VDSO_NR_VCLOCK_PAGES * PAGE_SIZE, VM_READ|VM_MAYREAD|VM_IO|VM_DONTDUMP| - VM_PFNMAP, + VM_PFNMAP|VM_SEALED_SYSMAP, &vvar_vclock_mapping); if (IS_ERR(vma)) {