public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Stefan Liebler <stli@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] s390x: Align child stack while clone. [BZ #27968]
Date: Tue, 15 Jun 2021 14:58:30 +0000 (GMT)	[thread overview]
Message-ID: <20210615145830.D58AE385740F@sourceware.org> (raw)

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

commit dbdc57dc81437c350c8c8e00a2d40d1749da004e
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Tue Jun 8 15:37:32 2021 +0200

    s390x: Align child stack while clone. [BZ #27968]
    
    Starting with recent commit 92a7d1343991897f77afe01041f3b77712445e47
    "x86-64: Align child stack to 16 bytes [BZ #27902]"
    the new test misc/tst-misalign-clone has failed on s390x/s390.
    
    This patch is now aligning the stack to a double
    word boundary as also done in start.S files.

Diff:
---
 sysdeps/unix/sysv/linux/s390/s390-32/clone.S | 8 +++++---
 sysdeps/unix/sysv/linux/s390/s390-64/clone.S | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
index bb968db40b..08145e4156 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
@@ -33,11 +33,13 @@
 ENTRY(__clone)
 	st	%r6,24(%r15)		/* store %r6 to save area */
 	cfi_offset (%r6, -72)
-	lr	%r0,%r5			/* move *arg out of the way */
 	ltr     %r1,%r2			/* check fn and move to %r1 */
 	jz      error			/* no NULL function pointers */
-	ltr     %r2,%r3			/* check child_stack and move to %r2 */
-	jz	error			/* no NULL stack pointers */
+	lhi     %r0,-8			/* Align the child_stack to a ...  */
+	nr      %r3,%r0			/* double word boundary and ...  */
+	jz	error			/* avoid NULL stack pointers.  */
+	lr	%r0,%r5			/* move *arg out of the way */
+	lr	%r2,%r3			/* move child_stack to %r2 */
 	lr	%r3,%r4			/* move flags to %r3 */
 	lr	%r4,%r6			/* move parent_tid to %r4 */
 	l	%r5,100(%r15)		/* load child_tid from stack */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
index 9eafff7561..21d485e9e9 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
@@ -34,11 +34,13 @@
 ENTRY(__clone)
 	stg	%r6,48(%r15)		/* store %r6 to save area */
 	cfi_offset (%r6,-112)
-	lgr	%r0,%r5			/* move *arg out of the way */
 	ltgr    %r1,%r2			/* check fn and move to %r1 */
 	jz      error			/* no NULL function pointers */
-	ltgr    %r2,%r3			/* check child_stack and move to %r2 */
-	jz	error			/* no NULL stack pointers */
+	lghi	%r0,-16			/* Align the child_stack to a ...  */
+	ngr	%r3,%r0			/* double word boundary and ...  */
+	jz	error			/* avoid NULL stack pointers.  */
+	lgr	%r0,%r5			/* move *arg out of the way */
+	lgr	%r2,%r3			/* move child_stack to %r2  */
 	lgr	%r3,%r4			/* move flags to %r3 */
 	lgr	%r4,%r6			/* move parent_tid to %r4 */
 	lg	%r5,168(%r15)		/* load child_tid from stack */


                 reply	other threads:[~2021-06-15 14:58 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=20210615145830.D58AE385740F@sourceware.org \
    --to=stli@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).