Hi All,
This series adds capabilities support for clone3 syscall along with
set of testcases in morello clone kselftests.
Changes available at:
https://git.morello-project.org/Bea/linux/-/tree/morello/clone3_v5
LTP changes:
https://git.morello-project.org/Bea/morello-linux-ltp/-/tree/morello/clone3
To run clone3 tests:
./runltp -f syscalls -s clone3
v5:
[PATCH 3/3]
- improved handling of default size for clone3 args
- fixed alignment in code layout
- dropped redundant cast
v4:
[PATCH 1/3]
- fixed commit message referring to the wrong copy routine
[PATCH 3/3]
- dropped setting default size for clone3 args
- dropped stale comment regarding re-using bits from clone_args flags
- switched ASSERT_FALSE to ASSERT_EQ when comparing pids in child process
- added caching tls value to safely unmap memory
- added validation for both clone stack and tls
- switch from clone_args-> tls to actual thread data when checking for tag in
cloned process
v3:
[PATCH 1/3]:
- updated commit message to reflect actual changes
[PATCH 2/3]:
- fixed type casting and sizes for copy routines
- swapped order of args for clone_args_size_ver
[PATCH 3/3]:
- added dedicated field for test custom flags instead of 'borrowing' one from
clone_args struct
- added test for stack before calling munmap in failing test cases
- switched to WSTOPPED for waitid call
v2:
- add copy_struct_from_user_with_ptr variant
- drop explicit padding from clone_args struct
- switch __alignof__ to sizeof for struct sizing conditions
- use __clone_args_size_ver macro when validating struct layout
- cache the current compat mode instead of relying on compiler optimizations
- drop use of as_user_ptr in favour of explicit casting
- use clone_args struct directly for kselftest test fixture
- add signalling to better handle dependencies between test threads
Beata Michalska (3):
uaccess: Preserve capability tags with copy_struct_from_user_with_ptr
fork: clone3: Add support for architectural capabilities
kselftests/arm64: morello: Add clone3 test-cases
include/linux/uaccess.h | 60 ++++-
include/uapi/linux/sched.h | 30 ++-
kernel/fork.c | 139 ++++++++---
.../testing/selftests/arm64/morello/Makefile | 1 +
tools/testing/selftests/arm64/morello/clone.c | 223 +++++++++++++++++-
5 files changed, 401 insertions(+), 52 deletions(-)
--
2.25.1
void* is used to align to 32-bits or 64-bits on 32 and 64 bits archs.
The pure-capability ABI breaks this assumption as the pointer size is
different than the word size, which is where the alignment requirement
comes from.
Indeed, the pointer size, and so void *, is now 16 bytes whereas the
expected alignment is still 8 bytes, as it is a different ABI but for
a 64-bit arch.
Change it to an unsigned long. Musl uses the same type for its definition
of struct sockaddr_storage.
Signed-off-by: Teo Couprie Diaz <teo.coupriediaz(a)arm.com>
---
include/uapi/linux/socket.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 51d6bb2f6765..28ff6a4aebca 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -22,7 +22,7 @@ struct __kernel_sockaddr_storage {
/* space to achieve desired size, */
/* _SS_MAXSIZE value minus size of ss_family */
};
- void *__align; /* implementation specific desired alignment */
+ unsigned long __align; /* implementation specific desired alignment */
};
};
--
2.25.1
This patch series addresses the VM_READ_CAPS/VM_WRITE_CAPS flags issue:
https://git.morello-project.org/morello/kernel/linux/-/issues/36
io_uring system uses buffers shared with userspace to read the io events
and report their results. The structs that populate the submission and
completion queues can contain capabilities. Shared mappings don't have
the Load/Store capabilities permission to avoid leaking capabilities
outside their original address space, so add two new VM flags that would
allow the kernel to set up such mappings.
While at it, also fix pte_modify to allow setting PTE_*_CAPS flags, add
new the new rc/wc smaps flags, and remove the automatic addition of
PTE_*_CAPS to user mappings.
To note: this wouldn't allow userspace to make arbitrary shared mappings
with tag access, the new VM flags would be for internal use only for the
time being.
v3:
- Improved documentation, comments, and commit message
- Fixed condition in Patch 3, now tested properly with Morello GDB
v2:
- Removed Patch 1 from the series as it wasn't essential
- Added docs to Documentation/filesystems/proc.rst
- Removed VM_RW_CAPS
- Moved definition of VM_*_CAPS just after the definition of VM_MTE
- Added details for a TODO related to file-backed mappings
- Introduced Patch 3 that removes an assumption about shared mappings
Review branch:
https://git.morello-project.org/tudcre01/linux/-/commits/vm_rw_caps_v3/
Thanks,
Tudor
Tudor Cretu (3):
arm64: morello: Add VM_READ_CAPS and VM_WRITE_CAPS flags
arm64: morello: Explicitly add VM_*_CAPS to private user mappings
arm64: morello: Check against VM_WRITE_CAPS in access_remote_cap
Documentation/filesystems/proc.rst | 2 ++
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/mman.h | 26 ++++++++++++++++++++++++--
arch/arm64/include/asm/page.h | 3 ++-
arch/arm64/include/asm/pgtable-prot.h | 12 +++++-------
arch/arm64/kernel/morello.c | 7 +++----
fs/proc/task_mmu.c | 4 ++++
include/linux/mm.h | 8 ++++++++
8 files changed, 49 insertions(+), 14 deletions(-)
--
2.25.1
void* is used to align to 32-bits or 64-bits on 32 and 64 bits archs.
Purecap breaks this assumption.
As struct __kernel_sockaddr_storage is used for both Aarch64 and purecap
user structs, we cannot reliably use void* for alignment.
Change it to an unsigned long. Musl uses the same type for its definition
of struct sockaddr_storage.
Signed-off-by: Teo Couprie Diaz <teo.coupriediaz(a)arm.com>
---
include/uapi/linux/socket.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 51d6bb2f6765..28ff6a4aebca 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -22,7 +22,7 @@ struct __kernel_sockaddr_storage {
/* space to achieve desired size, */
/* _SS_MAXSIZE value minus size of ss_family */
};
- void *__align; /* implementation specific desired alignment */
+ unsigned long __align; /* implementation specific desired alignment */
};
};
--
2.25.1
Hi All,
This series adds capabilities support for clone3 syscall along with
set of testcases in morello clone kselftests.
Changes available at:
https://git.morello-project.org/Bea/linux/-/tree/morello/clone3_v4
LTP changes:
https://git.morello-project.org/Bea/morello-linux-ltp/-/tree/morello/clone3
To run clone3 tests:
./runltp -f syscalls -s clone3
v4:
[PATCH 1/3]
- fixed commit message referring to the wrong copy routine
[PATCH 3/3]
- dropped setting default size for clone3 args
- dropped stale comment regarding re-using bits from clone_args flags
- switched ASSERT_FALSE to ASSERT_EQ when comparing pids in child process
- added caching tls value to safely unmap memory
- added validation for both clone stack and tls
- switch from clone_args-> tls to actual thread data when checking for tag in
cloned process
v3:
[PATCH 1/3]:
- updated commit message to reflect actual changes
[PATCH 2/3]:
- fixed type casting and sizes for copy routines
- swapped order of args for clone_args_size_ver
[PATCH 3/3]:
- added dedicated field for test custom flags instead of 'borrowing' one from
clone_args struct
- added test for stack before calling munmap in failing test cases
- switched to WSTOPPED for waitid call
v2:
- add copy_struct_from_user_with_ptr variant
- drop explicit padding from clone_args struct
- switch __alignof__ to sizeof for struct sizing conditions
- use __clone_args_size_ver macro when validating struct layout
- cache the current compat mode instead of relying on compiler optimizations
- drop use of as_user_ptr in favour of explicit casting
- use clone_args struct directly for kselftest test fixture
- add signalling to better handle dependencies between test threads
Beata Michalska (3):
uaccess: Preserve capability tags with copy_struct_from_user_with_ptr
fork: clone3: Add support for architectural capabilities
kselftests/arm64: morello: Add clone3 test-cases
include/linux/uaccess.h | 60 ++++-
include/uapi/linux/sched.h | 30 ++-
kernel/fork.c | 139 ++++++++---
.../testing/selftests/arm64/morello/Makefile | 1 +
tools/testing/selftests/arm64/morello/clone.c | 222 +++++++++++++++++-
5 files changed, 400 insertions(+), 52 deletions(-)
--
2.25.1
Hi All,
This series adds capabilities support for clone3 syscall along with
set of testcases in morello clone kselftests.
Changes available at:
https://git.morello-project.org/Bea/linux/-/tree/morello/clone3_v3
LTP changes:
https://git.morello-project.org/Bea/morello-linux-ltp/-/tree/morello/clone3
To run clone3 tests:
./runltp -f syscalls -s clone3
v3:
[PATCH 1/3]:
- updated commit message to reflect actual changes
[PATCH 2/3]:
- fixed type casting and sizes for copy routines
- swapped order of args for clone_args_size_ver
[PATCH 3/3]:
- added dedicated field for test custom flags instead of 'borrowing' one from
clone_args struct
- added test for stack before calling munmap in failing test cases
- switched to WSTOPPED for waitid call
v2:
- add copy_struct_from_user_with_ptr variant
- drop explicit padding from clone_args struct
- switch __alignof__ to sizeof for struct sizing conditions
- use __clone_args_size_ver macro when validating struct layout
- cache the current compat mode instead of relying on compiler optimizations
- drop use of as_user_ptr in favour of explicit casting
- use clone_args struct directly for kselftest test fixture
- add signalling to better handle dependencies between test threads
Beata Michalska (3):
uaccess: Preserve capability tags with copy_struct_from_user_with_ptr
fork: clone3: Add support for architectural capabilities
kselftests/arm64: morello: Add clone3 test-cases
include/linux/uaccess.h | 60 ++++-
include/uapi/linux/sched.h | 30 ++-
kernel/fork.c | 139 ++++++++---
.../testing/selftests/arm64/morello/Makefile | 1 +
tools/testing/selftests/arm64/morello/clone.c | 228 +++++++++++++++++-
5 files changed, 406 insertions(+), 52 deletions(-)
--
2.25.1
Hi All,
This series adds capabilities support for clone3 syscall along with
set of testcases in morello clone kselftests.
Changes available at:
https://git.morello-project.org/Bea/linux/-/tree/morello/clone3_v2
LTP changes:
https://git.morello-project.org/Bea/morello-linux-ltp/-/tree/morello/clone3
To run clone3 tests:
./runltp -f syscalls -s clone3
v2:
- add copy_struct_from_user_with_ptr variant
- drop explicit padding from clone_args struct
- switch __alignof__ to sizeof for struct sizing conditions
- use __clone_args_size_ver macro when validating struct layout
- cache the current compat mode instead of relying on compiler optimizations
- drop use of as_user_ptr in favour of explicit casting
- use clone_args struct directly for kselftest test fixture
- add signalling to better handle dependencies between test threads
Beata Michalska (3):
uaccess: Preserve capability tags with copy_struct_from_user
fork: clone3: Add support for architectural capabilities
kselftests/arm64: morello: Add clone3 test-cases
include/linux/uaccess.h | 60 ++++-
include/uapi/linux/sched.h | 30 ++-
kernel/fork.c | 135 +++++++---
.../testing/selftests/arm64/morello/Makefile | 1 +
tools/testing/selftests/arm64/morello/clone.c | 232 +++++++++++++++++-
5 files changed, 406 insertions(+), 52 deletions(-)
--
2.25.1
void* can cause issues for alignment now that its size depends on whether
it is compat or purecap. In struct __kernel_sockaddr_storage, it is not
annotated with __user, so it is affected.
Change it to an unsigned long. Musl uses the same type for its struct
definitions.
Signed-off-by: Teo Couprie Diaz <teo.coupriediaz(a)arm.com>
---
include/uapi/linux/socket.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 51d6bb2f6765..28ff6a4aebca 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -22,7 +22,7 @@ struct __kernel_sockaddr_storage {
/* space to achieve desired size, */
/* _SS_MAXSIZE value minus size of ss_family */
};
- void *__align; /* implementation specific desired alignment */
+ unsigned long __align; /* implementation specific desired alignment */
};
};
base-commit: bbd29c87073f43eb8c09e8a2c2f4508b46a831a0
--
2.25.1
Hi,
This series includes all the uAPI changes defined in the PCuABI spec
that are not already in the tree or posted on the list.
The patches are not meant to be merged right now, logically this should
happen together with the corresponding implementaton. Rather, I am
making these patches available for reference, as the emulation of PCuABI
is progressing in projects like libshim and requires the definition of
these uAPI macros.
The patches are also available in this branch:
https://git.morello-project.org/kbrodsky-arm/linux/-/commits/upcoming_uapi
Thanks,
Kevin
Kevin Brodsky (3):
uapi: errno.h: Introduce ERESERVATION
uapi: mm: Introduce PROT_MAX()
uapi: mm: Introduce PROT_CAP_INVOKE
include/uapi/asm-generic/errno.h | 2 ++
include/uapi/asm-generic/mman-common.h | 8 ++++++++
2 files changed, 10 insertions(+)
--
2.38.1