]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
clone.2: ERRORS: add EINVAL for improperly aligned 'child_stack' value
authorMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 9 May 2016 21:02:09 +0000 (23:02 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 9 May 2016 21:06:27 +0000 (23:06 +0200)
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>
man2/clone.2

index c9ce21c55b8124da3a87fa266a108100edbbe875..908861755f7fd44ddbf6daddf265fd5af5f2fbdf 100644 (file)
@@ -969,6 +969,13 @@ but the kernel was not configured with the
 .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