Hi Beata,
On 18-11-2022 00:05, Beata Michalska wrote:
Hi All,
This series adds capabilities support for clone3 syscall along with set of testcases in morello clone kselftests.
Struct clone_args signature after proposed changes:
__CHERI_PURE_CAPABILITY__ :
struct clone_args { __u64 flags __attribute__((__aligned__(8))); /* 0 8 */ __u8 __rsvd_v0_1[8]; /* 8 8 */ __kernel_aligned_uintptr_t pidfd; /* 16 16 */ __kernel_aligned_uintptr_t child_tid; /* 32 16 */ __kernel_aligned_uintptr_t parent_tid; /* 48 16 */ /* --- cacheline 1 boundary (64 bytes) --- */ __u64 exit_signal __attribute__((__aligned__(8))); /* 64 8 */ __u8 __rsvd_v0_2[8]; /* 72 8 */ __kernel_aligned_uintptr_t stack; /* 80 16 */ __u64 stack_size __attribute__((__aligned__(8))); /* 96 8 */ __u8 __rsvd_v0_3[8]; /* 104 8 */ __kernel_aligned_uintptr_t tls; /* 112 16 */ /* --- cacheline 2 boundary (128 bytes) --- */ __kernel_aligned_uintptr_t set_tid; /* 128 16 */ __u64 set_tid_size __attribute__((__aligned__(8))); /* 144 8 */ __u64 cgroup __attribute__((__aligned__(8))); /* 152 8 */
/* size: 160, cachelines: 3, members: 14 */ /* forced alignments: 5 */ /* last cacheline: 32 bytes */
};
otherwise:
struct clone_args { __u64 flags __attribute__((__aligned__(8))); /* 0 8 */ __u8 __rsvd_v0_1[0]; /* 8 0 */ __kernel_aligned_uintptr_t pidfd __attribute__((__aligned__(8))); /* 8 8 */ __kernel_aligned_uintptr_t child_tid __attribute__((__aligned__(8))); /* 16 8 */ __kernel_aligned_uintptr_t parent_tid __attribute__((__aligned__(8))); /* 24 8 */ __u64 exit_signal __attribute__((__aligned__(8))); /* 32 8 */ __u8 __rsvd_v0_2[0]; /* 40 0 */ __kernel_aligned_uintptr_t stack __attribute__((__aligned__(8))); /* 40 8 */ __u64 stack_size __attribute__((__aligned__(8))); /* 48 8 */ __u8 __rsvd_v0_3[0]; /* 56 0 */ __kernel_aligned_uintptr_t tls __attribute__((__aligned__(8))); /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ __kernel_aligned_uintptr_t set_tid __attribute__((__aligned__(8))); /* 64 8 */ __u64 set_tid_size __attribute__((__aligned__(8))); /* 72 8 */ __u64 cgroup __attribute__((__aligned__(8))); /* 80 8 */
/* size: 88, cachelines: 2, members: 14 */ /* forced alignments: 11 */ /* last cacheline: 24 bytes */
};
Changes available at: https://git.morello-project.org/Bea/linux/-/tree/morello/clone3 LTP changes: https://git.morello-project.org/Bea/morello-linux-ltp/-/tree/morello/clone3 To run clone3 tests: ./runltp -f syscalls -s clone3
Both this series and the LTP change look great to me! I am impressed by how neat they are...
Thanks, Tudor
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 | 2 +- include/uapi/linux/sched.h | 37 ++- kernel/fork.c | 123 ++++++-- tools/testing/selftests/arm64/morello/clone.c | 269 +++++++++++++++++- 4 files changed, 391 insertions(+), 40 deletions(-)