Add mseal() testing suite
v4 cover Add mseal() testing suite
Smoke test for mseal() syscall added in the kernel 6.10. All information can be found at the following link:
https://docs.kernel.org/userspace-api/mseal.html
---
Changes in v4:
- add mseal01 in runtest syscalls file
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- move memory allocation inside the child
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- don't use TST_ABI32 var anymore, but let tst_syscall handling ENOSYS
- call protection key syscalls via tst_syscall
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Andrea Cervesato (2):
Add mseal() syscall declaration
Add mseal01 test
include/lapi/syscalls/aarch64.in | 1 + include/lapi/syscalls/arc.in | 1 + include/lapi/syscalls/arm.in | 1 + include/lapi/syscalls/hppa.in | 1 + include/lapi/syscalls/i386.in | 1 + include/lapi/syscalls/ia64.in | 1 + include/lapi/syscalls/loongarch.in | 1 + include/lapi/syscalls/mips_n32.in | 1 + include/lapi/syscalls/mips_n64.in | 1 + include/lapi/syscalls/mips_o32.in | 1 + include/lapi/syscalls/powerpc.in | 1 + include/lapi/syscalls/powerpc64.in | 1 + include/lapi/syscalls/s390.in | 1 + include/lapi/syscalls/s390x.in | 1 + include/lapi/syscalls/sh.in | 1 + include/lapi/syscalls/sparc.in | 1 + include/lapi/syscalls/sparc64.in | 1 + include/lapi/syscalls/x86_64.in | 1 + runtest/syscalls | 2 + testcases/kernel/syscalls/mseal/.gitignore | 1 + testcases/kernel/syscalls/mseal/Makefile | 7 ++ testcases/kernel/syscalls/mseal/mseal01.c | 156 +++++++++++++++++++++++++++++ 22 files changed, 184 insertions(+)
---
base-commit: 8422d4680b21e6576da63c677b5d49f46b477df0
change-id: 20240607-mseal-dfac12675096
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 1/2 Add mseal() syscall declaration
From: Andrea Cervesato <[email protected]>
--- include/lapi/syscalls/aarch64.in | 1 + include/lapi/syscalls/arc.in | 1 + include/lapi/syscalls/arm.in | 1 + include/lapi/syscalls/hppa.in | 1 + include/lapi/syscalls/i386.in | 1 + include/lapi/syscalls/ia64.in | 1 + include/lapi/syscalls/loongarch.in | 1 + include/lapi/syscalls/mips_n32.in | 1 + include/lapi/syscalls/mips_n64.in | 1 + include/lapi/syscalls/mips_o32.in | 1 + include/lapi/syscalls/powerpc.in | 1 + include/lapi/syscalls/powerpc64.in | 1 + include/lapi/syscalls/s390.in | 1 + include/lapi/syscalls/s390x.in | 1 + include/lapi/syscalls/sh.in | 1 + include/lapi/syscalls/sparc.in | 1 + include/lapi/syscalls/sparc64.in | 1 + include/lapi/syscalls/x86_64.in | 1 + 18 files changed, 18 insertions(+)
include/lapi/syscalls/aarch64.in +1 -0
@@ -301,4 +301,5 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462 _sysctl 1078
include/lapi/syscalls/arc.in +1 -0
@@ -321,3 +321,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/arm.in +1 -0
@@ -400,3 +400,4 @@ landlock_restrict_self (__NR_SYSCALL_BASE+446) memfd_secret (__NR_SYSCALL_BASE+447) futex_waitv (__NR_SYSCALL_BASE+449) cachestat (__NR_SYSCALL_BASE+451) +mseal (__NR_SYSCALL_BASE+462)
include/lapi/syscalls/hppa.in +1 -0
@@ -48,3 +48,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/i386.in +1 -0
@@ -435,3 +435,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/ia64.in +1 -0
@@ -348,3 +348,4 @@ landlock_add_rule 1469 landlock_restrict_self 1470 futex_waitv 1473 cachestat 1475 +mseal 1486
include/lapi/syscalls/loongarch.in +1 -0
@@ -306,3 +306,4 @@ process_mrelease 448 futex_waitv 449 set_mempolicy_home_node 450 cachestat 451 +mseal 462
include/lapi/syscalls/mips_n32.in +1 -0
@@ -375,3 +375,4 @@ landlock_add_rule 6445 landlock_restrict_self 6446 futex_waitv 6449 cachestat 6451 +mseal 6462
include/lapi/syscalls/mips_n64.in +1 -0
@@ -351,3 +351,4 @@ landlock_add_rule 5445 landlock_restrict_self 5446 futex_waitv 5449 cachestat 5451 +mseal 5462
include/lapi/syscalls/mips_o32.in +1 -0
@@ -421,3 +421,4 @@ landlock_add_rule 4445 landlock_restrict_self 4446 futex_waitv 4449 cachestat 4451 +mseal 4462
include/lapi/syscalls/powerpc.in +1 -0
@@ -428,3 +428,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/powerpc64.in +1 -0
@@ -428,3 +428,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/s390.in +1 -0
@@ -415,3 +415,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/s390x.in +1 -0
@@ -363,3 +363,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/sh.in +1 -0
@@ -409,3 +409,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/sparc.in +1 -0
@@ -414,3 +414,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/sparc64.in +1 -0
@@ -379,3 +379,4 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462
include/lapi/syscalls/x86_64.in +1 -0
@@ -356,6 +356,7 @@ landlock_add_rule 445 landlock_restrict_self 446 futex_waitv 449 cachestat 451 +mseal 462 rt_sigaction 512 rt_sigreturn 513 ioctl 514
Signature · 5 lines
2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 2/2 Add mseal01 test
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
This is a smoke test that verifies if mseal() protects specific VMA portions of a process. According to documentation, the syscall should protect memory from the following actions:
- unmapping, moving to another location, and shrinking the size, via munmap() and mremap()
- moving or expanding a different VMA into the current location, via mremap()
- modifying a VMA via mmap(MAP_FIXED)
- mprotect() and pkey_mprotect()
- destructive madvice() behaviors (e.g. MADV_DONTNEED) for anonymous memory, when users don’t have write permission to the memory
Any of the described actions is recognized via EPERM errno.
--- runtest/syscalls | 2 + testcases/kernel/syscalls/mseal/.gitignore | 1 + testcases/kernel/syscalls/mseal/Makefile | 7 ++ testcases/kernel/syscalls/mseal/mseal01.c | 156 +++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+)
runtest/syscalls +2 -0
@@ -878,6 +878,8 @@ mremap04 mremap04 mremap05 mremap05 mremap06 mremap06 +mseal01 mseal01 + msgctl01 msgctl01 msgctl02 msgctl02 msgctl03 msgctl03
testcases/kernel/syscalls/mseal/.gitignore new file +1 -0
@@ -0,0 +1 @@ +mseal01
testcases/kernel/syscalls/mseal/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2023 SUSE LLC Andrea Cervesato <[email protected]> + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/mseal/mseal01.c new file +156 -0
156 lines not on this page · raw message
Signature · 5 lines
2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp