about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2021-06-01 09:23:40 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2021-06-01 09:47:48 +0100
commit3842ba494963b1d76ad5f68b8d1e5c2279160e31 (patch)
tree3e324044d4625eb20678d950cb655d78c722e365 /sysdeps
parenta55e2da2702e235fa0ae66a116d304d1bffc060a (diff)
downloadglibc-3842ba494963b1d76ad5f68b8d1e5c2279160e31.tar.gz
glibc-3842ba494963b1d76ad5f68b8d1e5c2279160e31.tar.xz
glibc-3842ba494963b1d76ad5f68b8d1e5c2279160e31.zip
aarch64: align stack in clone [BZ #27939]
The AArch64 PCS requires 16 byte aligned stack.  Previously if the
caller passed an unaligned stack to clone then the child crashed.

Fixes bug 27939.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/clone.S2
1 files changed, 2 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S
index c9e63bae48..fe04bce6b6 100644
--- a/sysdeps/unix/sysv/linux/aarch64/clone.S
+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S
@@ -47,6 +47,8 @@ ENTRY(__clone)
 	/* Sanity check args.  */
 	mov	x0, #-EINVAL
 	cbz	x10, .Lsyscall_error
+	/* Align sp.  */
+	and	x1, x1, -16
 	cbz	x1, .Lsyscall_error
 
 	/* Do the system call.  */