@@ -46,6 +46,10 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
}
#ifndef HAVE_CLONE3
+
+#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */
+#define CLONE_ARGS_SIZE_VER2 88 /* sizeof third published struct */
+
struct clone_args {
uint64_t __attribute__((aligned(8))) flags;
uint64_t __attribute__((aligned(8))) pidfd;
@@ -34,7 +34,8 @@ 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, CLONE_ARGS_SIZE_VER0 - 1, 0, NULL, SIGCHLD, 0, 0, 0, EINVAL},
+ {"short size for clone_into_group flag", &valid_args, CLONE_ARGS_SIZE_VER2 - 1, CLONE_INTO_CGROUP, 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},