public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Joseph Myers <jsm28@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] mips: align stack in clone [BZ #28223]
Date: Thu, 12 Aug 2021 20:32:23 +0000 (GMT)	[thread overview]
Message-ID: <20210812203223.C589B3835C0F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe

commit 1f51cd9a860ee45eee8a56fb2ba925267a2a7bfe
Author: Xi Ruoyao <xry111@mengyan1223.wang>
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


                 reply	other threads:[~2021-08-12 20:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210812203223.C589B3835C0F@sourceware.org \
    --to=jsm28@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).