]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - arch/arm64/kernel/process.c
arm64: get rid of fork/vfork/clone wrappers
[mirror_ubuntu-zesty-kernel.git] / arch / arm64 / kernel / process.c
index bf615e212c6c1bc42ef526c673f5493566ef3597..f82987a784af8282f0740d207a309df787fb28dc 100644 (file)
@@ -246,14 +246,20 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
                *childregs = *regs;
                childregs->regs[0] = 0;
                if (is_compat_thread(task_thread_info(p))) {
-                       childregs->compat_sp = stack_start;
+                       if (stack_start)
+                               childregs->compat_sp = stack_start;
                } else {
                        /*
                         * Read the current TLS pointer from tpidr_el0 as it may be
                         * out-of-sync with the saved value.
                         */
                        asm("mrs %0, tpidr_el0" : "=r" (tls));
-                       childregs->sp = stack_start;
+                       if (stack_start) {
+                               /* 16-byte aligned stack mandatory on AArch64 */
+                               if (stack_start & 15)
+                                       return -EINVAL;
+                               childregs->sp = stack_start;
+                       }
                }
                /*
                 * If a TLS pointer was passed to clone (4th argument), use it