]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
aarch64: align stack in clone [BZ #27939]
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 1 Jun 2021 08:23:40 +0000 (09:23 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 1 Jun 2021 08:47:48 +0000 (09:47 +0100)
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.

sysdeps/unix/sysv/linux/aarch64/clone.S

index c9e63bae48507896a9639f2fe3eb6f954b0a033f..fe04bce6b6747742ec03bd74d2771671f8dfe8ff 100644 (file)
@@ -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.  */