f21993
commit 3842ba494963b1d76ad5f68b8d1e5c2279160e31
f21993
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
f21993
Date:   Tue Jun 1 09:23:40 2021 +0100
f21993
f21993
    aarch64: align stack in clone [BZ #27939]
f21993
    
f21993
    The AArch64 PCS requires 16 byte aligned stack.  Previously if the
f21993
    caller passed an unaligned stack to clone then the child crashed.
f21993
    
f21993
    Fixes bug 27939.
f21993
f21993
diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S
f21993
index e0653048259dd9a3..4a1a999447ee5cf1 100644
f21993
--- a/sysdeps/unix/sysv/linux/aarch64/clone.S
f21993
+++ b/sysdeps/unix/sysv/linux/aarch64/clone.S
f21993
@@ -48,6 +48,8 @@ ENTRY(__clone)
f21993
 	/* Sanity check args.  */
f21993
 	mov	x0, #-EINVAL
f21993
 	cbz	x10, .Lsyscall_error
f21993
+	/* Align sp.  */
f21993
+	and	x1, x1, -16
f21993
 	cbz	x1, .Lsyscall_error
f21993
 
f21993
 	/* Do the system call.  */