Linux SNPS ARC Archive mirror
 help / color / mirror / Atom feed
From: Pavel.Kozlov@synopsys.com
To: libc-alpha@sourceware.org
Cc: linux-snps-arc@lists.infradead.org,
	Pavel Kozlov <Pavel.Kozlov@synopsys.com>
Subject: [PATCH] ARC: align child stack in clone
Date: Wed, 21 Dec 2022 20:19:46 +0400	[thread overview]
Message-ID: <20221221161946.12090-1-kozlov@synopsys.com> (raw)

From: Pavel Kozlov <pavel.kozlov@synopsys.com>

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.
---
 sysdeps/unix/sysv/linux/arc/clone.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sysdeps/unix/sysv/linux/arc/clone.S b/sysdeps/unix/sysv/linux/arc/clone.S
index bd924890844a..f32c83f17a65 100644
--- a/sysdeps/unix/sysv/linux/arc/clone.S
+++ b/sysdeps/unix/sysv/linux/arc/clone.S
@@ -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)
 
-- 
2.25.1


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

             reply	other threads:[~2022-12-21 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 16:19 Pavel.Kozlov [this message]
2023-01-16 14:08 ` [PATCH] ARC: align child stack in clone Adhemerval Zanella Netto
2023-01-25 15:53   ` Pavel Kozlov

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=20221221161946.12090-1-kozlov@synopsys.com \
    --to=pavel.kozlov@synopsys.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-snps-arc@lists.infradead.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).