Update the signature for clone_args struct bringing in support for capabilities and re-visit relevant testcases to take into account struct's new published versions.
Signed-off-by: Beata Michalska beata.michalska@arm.com --- v2: - pull in definition of offsetoff from stddef.h
include/lapi/clone.h | 19 +++++++++++-------- testcases/kernel/syscalls/clone3/clone302.c | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/include/lapi/clone.h b/include/lapi/clone.h index 437d1376f..6ff5e618b 100644 --- a/include/lapi/clone.h +++ b/include/lapi/clone.h @@ -17,14 +17,17 @@
#ifndef HAVE_CLONE3 struct clone_args { - uint64_t __attribute__((aligned(8))) flags; - uint64_t __attribute__((aligned(8))) pidfd; - uint64_t __attribute__((aligned(8))) child_tid; - uint64_t __attribute__((aligned(8))) parent_tid; - uint64_t __attribute__((aligned(8))) exit_signal; - uint64_t __attribute__((aligned(8))) stack; - uint64_t __attribute__((aligned(8))) stack_size; - uint64_t __attribute__((aligned(8))) tls; + __aligned_u64 flags; + __kernel_aligned_uintptr_t pidfd; + __kernel_aligned_uintptr_t child_tid; + __kernel_aligned_uintptr_t parent_tid; + __aligned_u64 exit_signal; + __kernel_aligned_uintptr_t stack; + __aligned_u64 stack_size; + __kernel_aligned_uintptr_t tls; + __kernel_aligned_uintptr_t set_tid; + __aligned_u64 set_tid_size; + __aligned_u64 cgroup; };
static inline int clone3(struct clone_args *args, size_t size) diff --git a/testcases/kernel/syscalls/clone3/clone302.c b/testcases/kernel/syscalls/clone3/clone302.c index 08d6417ce..ec188bb05 100644 --- a/testcases/kernel/syscalls/clone3/clone302.c +++ b/testcases/kernel/syscalls/clone3/clone302.c @@ -12,6 +12,7 @@ #define _GNU_SOURCE
#include <stdlib.h> +#include <stddef.h>
#include "tst_test.h" #include "lapi/clone.h" @@ -34,7 +35,7 @@ static struct tcase { } tcases[] = { {"invalid args", &invalid_args, sizeof(*valid_args), 0, NULL, SIGCHLD, 0, 0, 0, EFAULT}, {"zero size", &valid_args, 0, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL}, - {"short size", &valid_args, sizeof(*valid_args) - 1, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL}, + {"short size", &valid_args, offsetof(struct clone_args, tls) - 1, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL}, {"extra size", &valid_args, sizeof(*valid_args) + 1, 0, NULL, SIGCHLD, 0, 0, 0, EFAULT}, {"sighand-no-VM", &valid_args, sizeof(*valid_args), CLONE_SIGHAND, NULL, SIGCHLD, 0, 0, 0, EINVAL}, {"thread-no-sighand", &valid_args, sizeof(*valid_args), CLONE_THREAD, NULL, SIGCHLD, 0, 0, 0, EINVAL},
On 19/12/2022 10:57, Beata Michalska wrote:
Update the signature for clone_args struct bringing in support for capabilities and re-visit relevant testcases to take into account struct's new published versions.
Signed-off-by: Beata Michalska beata.michalska@arm.com
v2:
- pull in definition of offsetoff from stddef.h
LGTM.
Kevin
include/lapi/clone.h | 19 +++++++++++-------- testcases/kernel/syscalls/clone3/clone302.c | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/include/lapi/clone.h b/include/lapi/clone.h index 437d1376f..6ff5e618b 100644 --- a/include/lapi/clone.h +++ b/include/lapi/clone.h @@ -17,14 +17,17 @@ #ifndef HAVE_CLONE3 struct clone_args {
- uint64_t __attribute__((aligned(8))) flags;
- uint64_t __attribute__((aligned(8))) pidfd;
- uint64_t __attribute__((aligned(8))) child_tid;
- uint64_t __attribute__((aligned(8))) parent_tid;
- uint64_t __attribute__((aligned(8))) exit_signal;
- uint64_t __attribute__((aligned(8))) stack;
- uint64_t __attribute__((aligned(8))) stack_size;
- uint64_t __attribute__((aligned(8))) tls;
- __aligned_u64 flags;
- __kernel_aligned_uintptr_t pidfd;
- __kernel_aligned_uintptr_t child_tid;
- __kernel_aligned_uintptr_t parent_tid;
- __aligned_u64 exit_signal;
- __kernel_aligned_uintptr_t stack;
- __aligned_u64 stack_size;
- __kernel_aligned_uintptr_t tls;
- __kernel_aligned_uintptr_t set_tid;
- __aligned_u64 set_tid_size;
- __aligned_u64 cgroup;
}; static inline int clone3(struct clone_args *args, size_t size) diff --git a/testcases/kernel/syscalls/clone3/clone302.c b/testcases/kernel/syscalls/clone3/clone302.c index 08d6417ce..ec188bb05 100644 --- a/testcases/kernel/syscalls/clone3/clone302.c +++ b/testcases/kernel/syscalls/clone3/clone302.c @@ -12,6 +12,7 @@ #define _GNU_SOURCE #include <stdlib.h> +#include <stddef.h> #include "tst_test.h" #include "lapi/clone.h" @@ -34,7 +35,7 @@ static struct tcase { } tcases[] = { {"invalid args", &invalid_args, sizeof(*valid_args), 0, NULL, SIGCHLD, 0, 0, 0, EFAULT}, {"zero size", &valid_args, 0, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL},
- {"short size", &valid_args, sizeof(*valid_args) - 1, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL},
- {"short size", &valid_args, offsetof(struct clone_args, tls) - 1, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL}, {"extra size", &valid_args, sizeof(*valid_args) + 1, 0, NULL, SIGCHLD, 0, 0, 0, EFAULT}, {"sighand-no-VM", &valid_args, sizeof(*valid_args), CLONE_SIGHAND, NULL, SIGCHLD, 0, 0, 0, EINVAL}, {"thread-no-sighand", &valid_args, sizeof(*valid_args), CLONE_THREAD, NULL, SIGCHLD, 0, 0, 0, EINVAL},
linux-morello-ltp@op-lists.linaro.org