The MIPS O32 ABI requires 4 byte aligned stack, and the MIPS N64 and N32
ABI require 8 byte aligned stack. Previously if the caller passed an
unaligned stack to clone the the child misbehaved.
Fixes bug 28223.
(cherry picked from commit
1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe)
[19193] nptl: pthread_kill, pthread_cancel should not fail after exit
[28036] Incorrect types for pthread_mutexattr_set/getrobust_np
[28182] _TIME_BITS=64 in C++ has issues with fcntl, ioctl, prctl
+ [28223] mips: clone does not align stack
[28310] Do not use affinity mask for sysconf (_SC_NPROCESSORS_CONF)
[28340] ld.so crashes while loading a DSO with a read-only dynamic section
[28357] deadlock between pthread_create and ELF constructors
.set at
#endif
+ /* Align stack to 4/8 bytes per the ABI. */
+#if _MIPS_SIM == _ABIO32
+ li t0,-4
+#else
+ li t0,-8
+#endif
+ and a1,a1,t0
/* Sanity check arguments. */
li v0,EINVAL