From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1105) id C589B3835C0F; Thu, 12 Aug 2021 20:32:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C589B3835C0F Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Joseph Myers To: glibc-cvs@sourceware.org Subject: [glibc] mips: align stack in clone [BZ #28223] X-Act-Checkin: glibc X-Git-Author: Xi Ruoyao X-Git-Refname: refs/heads/master X-Git-Oldrev: 4cc79c217744743077bf7a0ec5e0a4318f1e6641 X-Git-Newrev: 1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe Message-Id: <20210812203223.C589B3835C0F@sourceware.org> Date: Thu, 12 Aug 2021 20:32:23 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2021 20:32:23 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe commit 1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe Author: Xi Ruoyao Date: Thu Aug 12 20:31:59 2021 +0000 mips: align stack in clone [BZ #28223] 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. Diff: --- sysdeps/unix/sysv/linux/mips/clone.S | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S index 71d9dba8bd..43a5ad3a40 100644 --- a/sysdeps/unix/sysv/linux/mips/clone.S +++ b/sysdeps/unix/sysv/linux/mips/clone.S @@ -55,6 +55,13 @@ NESTED(__clone,4*SZREG,sp) .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