As noted by Colin King:
Currently, the aarch64 clone() system call requires the stack
to be aligned at a 16 byte boundary, see
arch/arm64/kernel/process.c, copy_thread():
if (stack_start) {
if (is_compat_thread(task_thread_info(p)))
childregs->compat_sp = stack_start;
/* 16-byte aligned stack mandatory on AArch64 */
else if (stack_start & 15)
return -EINVAL;
else
childregs->sp = stack_start;
}
..and returns -EINVAL if not aligned correctly. This should
be added to the manual page clone(2) as it took me a while to
figure out why clone() was failing with -EINVAL for aarch64
but not on x86.
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
.B CONFIG_UTS
option.
.TP
+.B EINVAL
+.I child_stack
+is not aligned to a suitable boundary for this architecture.
+For example, on aarch64,
+.I child_stack
+must be a multiple of 16.
+.TP
.B ENOMEM
Cannot allocate sufficient memory to allocate a task structure for the
child, or to copy those parts of the caller's context that need to be