mseal system mappings fix + s390 enablement
Subsystems (3)
Heiko Carstens
maintainercover mseal system mappings fix + s390 enablement
When rebasing the mseal series on top of the generic vdso data storage the VM_SEALED_SYSMAP vm flag for the vvar mapping got lost. Add that again.
Also add s390 support for MSEAL_SYSTEM_MAPPINGS.
Heiko Carstens (2):
mseal sysmap: generic vdso vvar mapping
mseal sysmap: enable s390
arch/s390/Kconfig | 1 + arch/s390/kernel/vdso.c | 2 +- lib/vdso/datastore.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.45.2
Heiko Carstens
maintainerPATCH 1/2 mseal sysmap: generic vdso vvar mapping
With the introduction of the generic vdso data storage the VM_SEALED_SYSMAP vm flag must be moved from the architecture specific _install_special_mapping() call [1] [2] which maps the vvar mapping to generic code.
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
--- lib/vdso/datastore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/vdso/datastore.c +2 -1
@@ -99,7 +99,8 @@ const struct vm_special_mapping vdso_vvar_mapping = {struct vm_area_struct *vdso_install_vvar_mapping (struct mm_struct *mm,unsigned long addr) {return _install_special_mapping (mm, addr,VDSO_NR_PAGES *PAGE_SIZE , -VM_READ |VM_MAYREAD |VM_IO |VM_DONTDUMP |VM_PFNMAP , +VM_READ |VM_MAYREAD |VM_IO |VM_DONTDUMP | +VM_PFNMAP |VM_SEALED_SYSMAP , &vdso_vvar_mapping); }
Signature · 1 line
2.45.2
Re: [PATCH mm-unstable 1/2] mseal sysmap: generic vdso vvar mapping
Hi Heiko,
Quoted 4 lines · Heiko Carstens
With the introduction of the generic vdso data storage the
VM_SEALED_SYSMAPvm flag must be moved from the architecture specific_install_special_mapping()call [1] [2] which maps the vvar mapping to generic code.
I think this change should be part of the merge commit between the trees carrying the generic vdso data storage and mseal for system mappings.
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
Quoted 25 lines
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]Signed-off-by Heiko Carstens <[email protected]>--- lib/vdso/datastore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/vdso/datastore.c +2
-1@@ -99,7 +99,8 @@ const struct vm_special_mapping vdso_vvar_mapping = {struct vm_area_struct *vdso_install_vvar_mapping (struct mm_struct *mm,unsigned long addr) {return _install_special_mapping (mm, addr,VDSO_NR_PAGES *PAGE_SIZE , -VM_READ |VM_MAYREAD |VM_IO |VM_DONTDUMP |VM_PFNMAP , +VM_READ |VM_MAYREAD |VM_IO |VM_DONTDUMP | +VM_PFNMAP |VM_SEALED_SYSMAP , &vdso_vvar_mapping); }Signature · 1 line
2.45.2
Heiko Carstens
maintainerRe: [PATCH mm-unstable 1/2] mseal sysmap: generic vdso vvar mapping
Quoted 8 lines · Thomas Weißschuh
Hi Heiko,
Quoted 4 lines · Heiko Carstens
With the introduction of the generic vdso data storage the
VM_SEALED_SYSMAPvm flag must be moved from the architecture specific_install_special_mapping()call [1] [2] which maps the vvar mapping to generic code.
Quoted 5 lines
I think this change should be part of the merge commit between the trees carrying the generic vdso data storage and mseal for system mappings.
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
Yes, but Andrew added your patches into his tree and on top of that the mseal patches:
https://lore.kernel.org/all/[email protected]/
https://web.git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/log/?h=mm-unstable
When doing that the vvar bits got lost. I don't know what Andrew's plans for the merge window are, but right now there is no merge commit which could be fixed.
Re: [PATCH mm-unstable 1/2] mseal sysmap: generic vdso vvar mapping
In reply to Heiko CarstensQuoted 9 lines · Heiko Carstens
With the introduction of the generic vdso data storage the
VM_SEALED_SYSMAPvm flag must be moved from the architecture specific_install_special_mapping()call [1] [2] which maps the vvar mapping to generic code.[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]Signed-off-by Heiko Carstens <[email protected]>
Since CONFIG_MSEAL_SYSTEM_MAPPINGS this relies upon ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS, this is safe to do in generic code (otherwise VM_SEALED_SYSMAP is VM_NONE).
So all good and:
Quoted 21 lines
--- lib/vdso/datastore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/vdso/datastore.c +2
-2@@ -99,7 +99,8 @@ const struct vm_special_mapping vdso_vvar_mapping = {struct vm_area_struct *vdso_install_vvar_mapping (struct mm_struct *mm,unsigned long addr) {return _install_special_mapping (mm, addr,VDSO_NR_PAGES *PAGE_SIZE , -VM_READ |VM_MAYREAD |VM_IO |VM_DONTDUMP |VM_PFNMAP , +VM_READ |VM_MAYREAD |VM_IO |VM_DONTDUMP | +VM_PFNMAP |VM_SEALED_SYSMAP , &vdso_vvar_mapping); } --2.45.2
Re: [PATCH mm-unstable 1/2] mseal sysmap: generic vdso vvar mapping
In reply to Heiko CarstensQuoted 6 lines · Heiko Carstens
With the introduction of the generic vdso data storage the
VM_SEALED_SYSMAPvm flag must be moved from the architecture specific_install_special_mapping()call [1] [2] which maps the vvar mapping to generic code.
Thanks for fixing this merging problem.
The new selftest in mseal_system_mappings should catch this :-)
Hi Andrew,
when you apply this to mm-unstable, could you please insert this between:
commit 5bda54a4f304a7c3d65a40c9c3f015901caa2ce6
selftests: x86: test_mremap_vdso: skip if vdso is msealed and
commit 884323e928c6938923e5dfcb8a601b3363e1130b
mseal sysmap: enable x86-64
That will make the series complete.
Quoted 23 lines
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]Signed-off-by Heiko Carstens <[email protected]>--- lib/vdso/datastore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/vdso/datastore.c +2
-2@@ -99,7 +99,8 @@ const struct vm_special_mapping vdso_vvar_mapping = {struct vm_area_struct *vdso_install_vvar_mapping (struct mm_struct *mm,unsigned long addr) {return _install_special_mapping (mm, addr,VDSO_NR_PAGES *PAGE_SIZE , -VM_READ |VM_MAYREAD |VM_IO |VM_DONTDUMP |VM_PFNMAP , +VM_READ |VM_MAYREAD |VM_IO |VM_DONTDUMP | +VM_PFNMAP |VM_SEALED_SYSMAP , &vdso_vvar_mapping); } --
Quoted 2 lines
2.45.2
Heiko Carstens
maintainerPATCH 2/2 mseal sysmap: enable s390
In reply to Heiko CarstensProvide support for CONFIG_MSEAL_SYSTEM_MAPPINGS on s390, covering the vdso.
--- arch/s390/Kconfig | 1 + arch/s390/kernel/vdso.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
arch/s390/Kconfig +1 -0
@@ -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
arch/s390/kernel/vdso.c +1 -1
@@ -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)) {
Signature · 1 line
2.45.2
Re: [PATCH mm-unstable 2/2] mseal sysmap: enable s390
Quoted 4 lines · Heiko Carstens
Provide support for
CONFIG_MSEAL_SYSTEM_MAPPINGSon s390, covering the vdso.Signed-off-by Heiko Carstens <[email protected]>
Quoted 10 lines
--- arch/s390/Kconfig | 1 + arch/s390/kernel/vdso.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)arch/s390/Kconfig +0
-0
arch/s390/Kconfig config S390 · line 144
Quoted 4 lines
arch/s390/Kconfig +1
-0@@ -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.
Quoted 19 lines
arch/s390/Kconfig +0
-0select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_SUPPORTS_PER_VMA_LOCK select ARCH_USE_BUILTIN_BSWAParch/s390/kernel/vdso.c +1
-2@@ -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
Re: [PATCH mm-unstable 2/2] mseal sysmap: enable s390
In reply to Heiko CarstensQuoted 36 lines · Heiko Carstens
Provide support for
CONFIG_MSEAL_SYSTEM_MAPPINGSon s390, covering the vdso.Signed-off-by Heiko Carstens <[email protected]>--- arch/s390/Kconfig | 1 + arch/s390/kernel/vdso.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)arch/s390/Kconfig +1
-0@@ -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_BSWAParch/s390/kernel/vdso.c +1
-2@@ -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)) { --
Quoted 2 lines
2.45.2
Great ! one more architecture uses this feature.
Re: [PATCH mm-unstable 2/2] mseal sysmap: enable s390
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
Quoted 43 lines · Jeff Xu
Quoted 36 lines · Heiko Carstens
Provide support for
CONFIG_MSEAL_SYSTEM_MAPPINGSon s390, covering the vdso.Signed-off-by Heiko Carstens <[email protected]>--- arch/s390/Kconfig | 1 + arch/s390/kernel/vdso.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)arch/s390/Kconfig +1
-0@@ -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_BSWAParch/s390/kernel/vdso.c +1
-2@@ -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)) { --Quoted 2 lines
2.45.2
Great ! one more architecture uses this feature.
Reviewed-by Jeff Xu <[email protected]>
Heiko Carstens
maintainerRe: [PATCH mm-unstable 2/2] mseal sysmap: enable s390
Quoted 5 lines · Jeff Xu
One more thing: do you want to update
mseal.rstto 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
Re: [PATCH mm-unstable 2/2] mseal sysmap: enable s390
Quoted 5 lines · Heiko Carstens
Quoted 3 lines · Jeff Xu
One more thing: do you want to update
mseal.rstto add s390 as supported architecture?
Quoted 8 lines
Quoted 2 lines
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/... andscripts/get_feat.pl
Thanks for this suggestion. I will add that file.
-Jeff
Quoted 2 lines · Heiko Carstens
When rebasing the mseal series on top of the generic vdso data storage the
VM_SEALED_SYSMAPvm flag for the vvar mapping got lost. Add that again.
I'm confused by this? Some merge patch resolution thing?
I don't think this should be at the top of a description of a series, seems more like an addendum.
Quoted 2 lines
Also add s390 support for
MSEAL_SYSTEM_MAPPINGS.
'Also' = the whole thing this series does?
Can you confirm that s390 absolutely does not rely upon moving/manipulating/etc. the VDSO, VVAR, etc. mappings?
You should say that here.
Quoted 13 lines
Heiko Carstens (2):
mseal sysmap: generic vdso vvar mapping
mseal sysmap: enable s390arch/s390/Kconfig | 1 + arch/s390/kernel/vdso.c | 2 +- lib/vdso/datastore.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-)--
2.45.2
Heiko Carstens
maintainerQuoted 5 lines · Lorenzo Stoakes
Quoted 2 lines · Heiko Carstens
When rebasing the mseal series on top of the generic vdso data storage the
VM_SEALED_SYSMAPvm flag for the vvar mapping got lost. Add that again.I'm confused by this? Some merge patch resolution thing?
See my other mail.
Quoted 8 lines
Quoted 1 line
Also add s390 support for
MSEAL_SYSTEM_MAPPINGS.'Also' = the whole thing this series does?
Can you confirm that s390 absolutely does not rely upon moving/manipulating/etc. the VDSO, VVAR, etc. mappings?
You should say that here.
Just like for arm64, and x86_64 the s390 part is just adding the new vm flag to the _install_mappings() call in vdso code. Otherwise there is nothing to be considered.
Quoted 13 lines · Heiko Carstens
Quoted 5 lines · Lorenzo Stoakes
Quoted 2 lines · Heiko Carstens
When rebasing the mseal series on top of the generic vdso data storage the
VM_SEALED_SYSMAPvm flag for the vvar mapping got lost. Add that again.I'm confused by this? Some merge patch resolution thing?
See my other mail.
Quoted 4 lines
Quoted 1 line
Also add s390 support for
MSEAL_SYSTEM_MAPPINGS.'Also' = the whole thing this series does?
Quoted 8 lines
Quoted 4 lines
Can you confirm that s390 absolutely does not rely upon moving/manipulating/etc. the VDSO, VVAR, etc. mappings?
You should say that here.
Just like for arm64, and
x86_64the s390 part is just adding the new vm flag to the_install_mappings()call in vdso code. Otherwise there is nothing to be considered.
No, they are not just adding a flag, they are enabling the sealing of system mappings, if a user chooses to make use of it, which already breaks a number of useland applications that rely on remapping these.
if the architecture code ever needs to unmap/remap these, then this breaks your architecture.
I think it would be sensible to clearly indicate that enabling this feature does not break the s390 architecture and you've confirmed that by checking the code and ensuring that nowhere does it rely upon doing this.
Likely that's the case, but I'd suggest you ought to make sure...
x86-64 and arm64 were checked for this and confirmed to not ever need this.
This is why we're restricting by architecture.
Heiko Carstens
maintainerQuoted 15 lines · Lorenzo Stoakes
Quoted 3 lines
Just like for arm64, and
x86_64the s390 part is just adding the new vm flag to the_install_mappings()call in vdso code. Otherwise there is nothing to be considered.No, they are not just adding a flag, they are enabling the sealing of system mappings, if a user chooses to make use of it, which already breaks a number of useland applications that rely on remapping these.
if the architecture code ever needs to unmap/remap these, then this breaks your architecture.
I think it would be sensible to clearly indicate that enabling this feature does not break the s390 architecture and you've confirmed that by checking the code and ensuring that nowhere does it rely upon doing this.
Quoted 5 lines
Likely that's the case, but I'd suggest you ought to make sure...
x86-64 and arm64 were checked for this and confirmed to not ever need this.
This is why we're restricting by architecture.
Ok, I was assuming more that whoever enables that config option knows what he or she is doing. However as far as I know there is no s390 user space which relies on remapping vdso mappings.
When it comes to unmapping vdso: this would break user space since commit df29a7440c4b ("s390/signal: switch to using vdso for sigreturn and syscall restart") - there haven't been any reports.
Quoted 18 lines · Heiko Carstens
Quoted 17 lines · Lorenzo Stoakes
Quoted 3 lines
Just like for arm64, and
x86_64the s390 part is just adding the new vm flag to the_install_mappings()call in vdso code. Otherwise there is nothing to be considered.No, they are not just adding a flag, they are enabling the sealing of system mappings, if a user chooses to make use of it, which already breaks a number of useland applications that rely on remapping these.
if the architecture code ever needs to unmap/remap these, then this breaks your architecture.
I think it would be sensible to clearly indicate that enabling this feature does not break the s390 architecture and you've confirmed that by checking the code and ensuring that nowhere does it rely upon doing this.
Likely that's the case, but I'd suggest you ought to make sure...
Quoted 7 lines
Quoted 3 lines
x86-64 and arm64 were checked for this and confirmed to not ever need this.
This is why we're restricting by architecture.
Ok, I was assuming more that whoever enables that config option knows what he or she is doing. However as far as I know there is no s390 user space which relies on remapping vdso mappings.
Yeah, we allow for the 'user knows what they're doing' stuff when it comes to _userland_, but we obviously don't want to ship a known-broken kernel :)
Quoted 4 lines
When it comes to unmapping vdso: this would break user space since commit
df29a7440c4b("s390/signal: switch to using vdso for sigreturn and syscall restart") - there haven't been any reports.
OK that seems to implicitly suggest that you're fine with sealing then?
I had a quick glance and it seemed fine for s390. I mean it's _weird_ to remap any of this stuff so it'd be the odd one out that does it (ppc _seems_ to in _some_ circumstances need it, for instance).
So I think we're good? :)
Heiko Carstens
maintainerQuoted 11 lines · Lorenzo Stoakes
Quoted 3 lines
When it comes to unmapping vdso: this would break user space since commit
df29a7440c4b("s390/signal: switch to using vdso for sigreturn and syscall restart") - there haven't been any reports.OK that seems to implicitly suggest that you're fine with sealing then?
I had a quick glance and it seemed fine for s390. I mean it's _weird_ to remap any of this stuff so it'd be the odd one out that does it (ppc _seems_ to in _some_ circumstances need it, for instance).
So I think we're good? :)
Yes, for s390 we are good.
Quoted 7 lines · Heiko Carstens
Quoted 6 lines · Lorenzo Stoakes
Quoted 3 lines
When it comes to unmapping vdso: this would break user space since commit
df29a7440c4b("s390/signal: switch to using vdso for sigreturn and syscall restart") - there haven't been any reports.OK that seems to implicitly suggest that you're fine with sealing then?
Quoted 7 lines
Quoted 5 lines
I had a quick glance and it seemed fine for s390. I mean it's _weird_ to remap any of this stuff so it'd be the odd one out that does it (ppc _seems_ to in _some_ circumstances need it, for instance).
So I think we're good? :)
Yes, for s390 we are good.
Awesome :) series otherwise looks good.