ARC: align child stack in clone
authorPavel Kozlov <pavel.kozlov@synopsys.com>
Wed, 21 Dec 2022 16:19:46 +0000 (20:19 +0400)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 17 Feb 2023 19:12:52 +0000 (16:12 -0300)
The ARCv2 ABI requires 4 byte stack pointer alignment. Don't allow to
use unaligned child stack in clone. As the stack grows down,
align it down.

This was pointed by misc/tst-misalign-clone-internal and
misc/tst-misalign-clone tests. Stack alignmet fixes these tests
fails.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
sysdeps/unix/sysv/linux/arc/clone.S

index e41a594..7666496 100644 (file)
@@ -41,6 +41,7 @@
 
 ENTRY (__clone)
        cmp     r0, 0           /* @fn can't be NULL.  */
+       and     r1,r1,-4        /* @child_stack be 4 bytes aligned per ABI.  */
        cmp.ne  r1, 0           /* @child_stack can't be NULL.  */
        bz      L (__sys_err)