On 09/05/16 22:31, Mike Frysinger wrote: > On 25 Apr 2016 20:42, Colin Ian King wrote: >> 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. > > seems weird for the kernel to be enforcing this. is it just because of > the stated ABI ? or is there some weird requirement in the kernel itself > that requires this ? it's not like other arches have this check, and > there are def ABI requirements about stack alignments in C. > -mike > The article here indicates it is an aarch64 convention: https://community.arm.com/groups/processors/blog/2015/11/19/using-the-stack-in-aarch32-and-aarch64
Attachment:
signature.asc
Description: OpenPGP digital signature