提交 e6d9a525 编写于 作者: C Colin Ian King 提交者: Will Deacon

arm64: do not enforce strict 16 byte alignment to stack pointer

copy_thread should not be enforcing 16 byte aligment and returning
-EINVAL. Other architectures trap misaligned stack access with SIGBUS
so arm64 should follow this convention, so remove the strict enforcement
check.

For example, currently clone(2) fails with -EINVAL when passing
a misaligned stack and this gives little clue to what is wrong. Instead,
it is arguable that a SIGBUS on the fist access to a misaligned stack
allows one to figure out that it is a misaligned stack issue rather
than trying to figure out why an unconventional (and undocumented)
-EINVAL is being returned.
Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NWill Deacon <will.deacon@arm.com>
上级 61462c8a
...@@ -265,9 +265,6 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, ...@@ -265,9 +265,6 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
if (stack_start) { if (stack_start) {
if (is_compat_thread(task_thread_info(p))) if (is_compat_thread(task_thread_info(p)))
childregs->compat_sp = stack_start; childregs->compat_sp = stack_start;
/* 16-byte aligned stack mandatory on AArch64 */
else if (stack_start & 15)
return -EINVAL;
else else
childregs->sp = stack_start; childregs->sp = stack_start;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册