Message ID | 20221221161946.12090-1-kozlov@synopsys.com |
---|---|
State | Committed |
Commit | 87abcf9a6e34d64f556b0b9d3ccd2689b2c2e0b6 |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF78F3858284 for <patchwork@sourceware.org>; Wed, 21 Dec 2022 16:20:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF78F3858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671639647; bh=OM6KIBz5Y3WYwlTVp+9CZ6lvBSr8wKgXRS9cqsvd6d8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=MOmDGBwIPP7sTqss7p2lB7nZoYuWrmFA0DbePzG4sLyox0+SqTG5DbZrS6TLOeld8 Y10r4wp/9YK7r4hGCRX7mnT8/ClDuL3iJs2jdFQXagKv8y5pV5BiBbYY0TUU5bsGsH /2jKkSKh8WzkROUnMokVjgLU7dnkFAVhjJI9i+fQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-00230701.pphosted.com (mx0a-00230701.pphosted.com [148.163.156.19]) by sourceware.org (Postfix) with ESMTPS id 36E983858D1E for <libc-alpha@sourceware.org>; Wed, 21 Dec 2022 16:20:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 36E983858D1E Received: from pps.filterd (m0098571.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BLGDVuC010350; Wed, 21 Dec 2022 08:20:18 -0800 Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 3mkvu49hkd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 08:20:17 -0800 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 1E580400F0; Wed, 21 Dec 2022 16:20:16 +0000 (UTC) Received: from SNPS-o0WHuHJU73.internal.synopsys.com (snps-o0whuhju73.internal.synopsys.com [10.116.111.163]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client did not present a certificate) by mailhost.synopsys.com (Postfix) with ESMTPSA id 298FAA005D; Wed, 21 Dec 2022 16:20:13 +0000 (UTC) X-SNPS-Relay: 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 Message-Id: <20221221161946.12090-1-kozlov@synopsys.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: Pg9dTaTxD0yqJ5ezIeuOySkbwBIZwZXe X-Proofpoint-GUID: Pg9dTaTxD0yqJ5ezIeuOySkbwBIZwZXe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-21_08,2022-12-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 mlxscore=0 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 bulkscore=0 spamscore=0 priorityscore=1501 mlxlogscore=785 adultscore=0 lowpriorityscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212210136 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: "Pavel.Kozlov--- via Libc-alpha" <libc-alpha@sourceware.org> Reply-To: Pavel.Kozlov@synopsys.com Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
ARC: align child stack in clone
|
|
Checks
Context | Check | Description |
---|---|---|
dj/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
dj/TryBot-32bit | success | Build for i686 |
Commit Message
develop--- via Libc-alpha
Dec. 21, 2022, 4:19 p.m. UTC
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(+)
Comments
On 21/12/22 13:19, Pavel.Kozlov--- via Libc-alpha wrote: > 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. LGTM, although I can't really test it since the Synopsys qemu tree does not have qemu-user support [1]. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> [1] https://github.com/foss-for-synopsys-dwc-arc-processors/qemu > --- > 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) >
> LGTM, although I can't really test it since the Synopsys qemu tree does not > have qemu-user support [1]. Thank you for the review. I've checked this patch on QEMU with Linux system and on the ARC HSDK board. Also, I can say that it is possible to run ARC binaries on QEMU [1] in user mode. Currently not all instructions are supported in ARC QEMU and it is recommended to build binaries with extra -mcpu=archs compiler option, to reduce instruction set. Maybe this [2] will be also useful. It will be great to have this patch in coming 2.37. [1] https://github.com/foss-for-synopsys-dwc-arc-processors/qemu [2] https://github.com/foss-for-synopsys-dwc-arc-processors/glibc/wiki/Glibc-test-suite-for-a-target-without-native-GNU-toolchain#glibc-test-suite-execution-with-qemu-user-mode-emulation -- Pavel
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)