From patchwork Thu Mar 2 16:10:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Kozlov X-Patchwork-Id: 1750798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=pgMmY8fQ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=pfptdkimsnps header.b=dvGFyjFE; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=mail header.b=Gw2QQUmC; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PSGMm6Xbqz1yWw for ; Fri, 3 Mar 2023 03:12:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=vIypbPisOkMq1ne5veYMB4ZC12sH0P9R1a3tFFPojuA=; b=pgMmY8fQKHkTnN 3ZPgkNI61y0YP7FMO20xqub99KSsJH1F+zRiE47dPBeO6Aaap/tqda3EHXCQKBnenNsEMoJTbAMpk yDG679bFsghBbGkxKlmpQdZ13zgPzceaWCnZc5d0iQjvWLupnMhjdbf0mkAM3VqegCLYfIqaxklUo 7G7ZLhkKOAMx1/SSR6egcBYU4aGIWHbiL+HB7QF9+Duy31a15fLruIRm60o62CrZDNNIthuRhms9e sYXfMZtNKspzxDLGSIItffsMJ0O/UCOY7EEf+64Ajb/mrKkyXxppuw/TxLNrM/psbFuZp92gOgPs9 oZw8Sjsf6+MQPeSddRKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXlXV-002mfb-FA; Thu, 02 Mar 2023 16:12:17 +0000 Received: from mx0a-00230701.pphosted.com ([148.163.156.19]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXlXS-002mex-Vo for linux-snps-arc@lists.infradead.org; Thu, 02 Mar 2023 16:12:16 +0000 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 322Cf2Rc008287; Thu, 2 Mar 2023 08:12:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pfptdkimsnps; bh=py+Fqw2tjK/aZNs2IDeKGyQlA+DTg6Eb96RLbxmlo7Q=; b=dvGFyjFE6EkRUaYXhsHSVWaSDBA8IkFtaGaujpZopj6zfM+IT56LiPNVuS53mN+Akslg xvpNR56+IkdkTO6AOg85RVKD4CUEcZnu7dIlk9ndvl8VvKYP2tX8qsKlgjDFPDRRK9Rh NJq9Z9KF14nAoEnMWZYjgMznEvhLYs0UjkezvsPe5iCfAdBS3LPXXxBYSoLZNXyi0MMh EMze1JDuLRVr6n3T3aj1mgV8Ct0r5GH8F8V2G0SHUZRSWgPulGF0LYy2/2he37VAGBde Mu7N+rK9L4laTyozMicGbh8igajQBk61oZxJSroCKGyWTsLuFkyhq/hK2TbEA3VJEBHV Gg== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.73.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 3nyj7uumh1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Mar 2023 08:12:12 -0800 Received: from mailhost.synopsys.com (sv1-mailhost2.synopsys.com [10.205.2.132]) (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 C7FBD4007B; Thu, 2 Mar 2023 16:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1677773532; bh=KKDkXBAKX8wzDBNtB+0zPTtijqWg+Ew/ylrwF17hlfw=; h=From:To:Cc:Subject:Date:From; b=Gw2QQUmC2i90P3QeMEcggra6gDPVNzN2998ufoj3YDLycRv978tHWomDNzZk4vb5j B2phqV80f86Zx6tPDTkg9PzMF5qS5GrRnFrxtmSrlsbqRj0Wyg0kZI3j4Um8/mbhSF eOteQ/i3BzfLFTAO6ThHUCTG7HLqnMA/FNzgmyakDy3u1GaXrnrcca/UNxZd9whMlc 1DaJEoRs/kD3tI0Wk5ttVbc5Hu7PpclB+jQhKhFlgoER4HqLwGUmCdIpWXrdwVELGt q3VhRufBJz0qWvlN7BNIwNnNYoUcRgXT5xOHSOABcEaMQCWm1tyRS6726sDxJjSmQT Pa/hg4eaCmL2Q== Received: from SNPS-o0WHuHJU73.internal.synopsys.com (snps-o0whuhju73.internal.synopsys.com [10.116.105.29]) (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 B54A1A006D; Thu, 2 Mar 2023 16:12:07 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Pavel.Kozlov@synopsys.com To: libc-alpha@sourceware.org Cc: linux-snps-arc@lists.infradead.org, Pavel Kozlov Subject: [PATCH 1/2] ARC: Add the clone3 wrapper Date: Thu, 2 Mar 2023 20:10:18 +0400 Message-Id: <20230302161019.27192-1-kozlov@synopsys.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: MUDGHryKDFWlja64VYxhY7_gXthZk4de X-Proofpoint-ORIG-GUID: MUDGHryKDFWlja64VYxhY7_gXthZk4de X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-02_09,2023-03-02_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 phishscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303020140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230302_081215_101734_D5FF8728 X-CRM114-Status: GOOD ( 23.72 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Pavel Kozlov Use the clone3 wrapper on ARC. It doesn't care about stack alignment. All callers should provide an aligned stack. It follows the internal signature: extern int clone3 (struct clone_args *__cl_args, size_t __size, int (*__func) (void *__arg), void *__arg); --- Checked on arc-linux-gnu. Previously observed tst-misaling-clone-internal test fail was b [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Pavel Kozlov Use the clone3 wrapper on ARC. It doesn't care about stack alignment. All callers should provide an aligned stack. It follows the internal signature: extern int clone3 (struct clone_args *__cl_args, size_t __size, int (*__func) (void *__arg), void *__arg); Reviewed-by: Adhemerval Zanella --- Checked on arc-linux-gnu. Previously observed tst-misaling-clone-internal test fail was because I used outdated master branch. Full testsuite runs without regressions. But I also see fail of the new tst-spawn7, as already repoted at [1]. [1] https://sourceware.org/pipermail/libc-alpha/2023-February/145937.html sysdeps/unix/sysv/linux/arc/clone3.S | 90 ++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/arc/sysdep.h | 2 + 2 files changed, 92 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/arc/clone3.S diff --git a/sysdeps/unix/sysv/linux/arc/clone3.S b/sysdeps/unix/sysv/linux/arc/clone3.S new file mode 100644 index 000000000000..87a8272a3977 --- /dev/null +++ b/sysdeps/unix/sysv/linux/arc/clone3.S @@ -0,0 +1,90 @@ +/* The clone3 syscall wrapper. Linux/arc version. + Copyright (C) 2023 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#define _ERRNO_H 1 +#include + +/* The userland implementation is: + int clone3 (struct clone_args *cl_args, size_t size, + int (*func)(void *arg), void *arg); + + the kernel entry is: + int clone3 (struct clone_args *cl_args, size_t size); + + The parameters are passed in registers from userland: + r0: cl_args + r1: size + r2: func + r3: arg */ + +ENTRY(__clone3) + + /* Save args for the child. */ + mov r10, r0 /* cl_args */ + mov r11, r2 /* func */ + mov r12, r3 /* args */ + + /* Sanity check args. */ + breq r10, 0, L (__sys_err) /* No NULL cl_args pointer. */ + breq r11, 0, L (__sys_err) /* No NULL function pointer. */ + + /* Do the system call, the kernel expects: + r8: system call number + r0: cl_args + r1: size */ + mov r0, r10 + mov r8, __NR_clone3 + ARC_TRAP_INSN + + cmp r0, 0 + beq thread_start_clone3 /* Child returns. */ + blt L (__sys_err2) + j [blink] /* Parent returns. */ + +L (__sys_err): + mov r0, -EINVAL +L (__sys_err2): + b __syscall_error +PSEUDO_END (__clone3) + + + .align 4 + .type thread_start_clone3, %function +thread_start_clone3: + cfi_startproc + /* Terminate call stack by noting ra is undefined. */ + cfi_undefined (blink) + + /* Child jumps off to @fn with @arg as argument. */ + jl.d [r11] + mov r0, r12 + + /* exit() with result from @fn (already in r0). */ + mov r8, __NR_exit + ARC_TRAP_INSN + + /* In case it ever came back. */ + flag 1 + + cfi_endproc + .size thread_start_clone3, .-thread_start_clone3 + +libc_hidden_def (__clone3) +weak_alias (__clone3, clone3) diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h index dd6fe73445f9..88dc1dff017f 100644 --- a/sysdeps/unix/sysv/linux/arc/sysdep.h +++ b/sysdeps/unix/sysv/linux/arc/sysdep.h @@ -141,6 +141,8 @@ hidden_proto (__syscall_error) # define ARC_TRAP_INSN "trap_s 0 \n\t" +# define HAVE_CLONE3_WRAPPER 1 + # undef INTERNAL_SYSCALL_NCS # define INTERNAL_SYSCALL_NCS(number, nr_args, args...) \ ({ \ From patchwork Thu Mar 2 16:10:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Kozlov X-Patchwork-Id: 1750799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=viDiibId; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=pfptdkimsnps header.b=PI5UMxTQ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=mail header.b=lqMsLOZL; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PSGMv1MG9z1yWw for ; Fri, 3 Mar 2023 03:12:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7TX8LQg19ONKeBRVfcVhoLumuddF+AbbAdh0PZvGt1Q=; b=viDiibId78r+5x 5DWjDv/ewvWQHaLxtc7/YrixDQC16LOEX7sqbCcGWYfPxeF5dGll7VX4RJu/3Wn/ta5bnXiFqsjtt iQO9/dMAbyXFfDfIPxBicIohM4wDaoKtmxttC9QYFXi4qOobbBvhs54udhf0AQZcYdLfxpCbPhh5O Ej3xzVMROiPsj6jMMDHuAo+TQ1Y9YfY5GvF9OEybMBJwMEkaI5e6zeG3NE8YnHVVBHb6XZZhg+w7k BHBXkIkVfh4XIDkQ+Trwix04KV0sH5Uo/tucP1pJmjacJFi6P0QZaHG5fIwn2nK4s8IWsFWzLeW8h 70DFaomVin8R2SduLzKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXlXb-002mhV-Sq; Thu, 02 Mar 2023 16:12:23 +0000 Received: from mx0a-00230701.pphosted.com ([148.163.156.19]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXlXY-002mgZ-Kb for linux-snps-arc@lists.infradead.org; Thu, 02 Mar 2023 16:12:21 +0000 Received: from pps.filterd (m0297266.ppops.net [127.0.0.1]) by mx0a-00230701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 322G51Lb010064; Thu, 2 Mar 2023 08:12:20 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pfptdkimsnps; bh=Vg249BbTkvNkrtiiv3LWdoFEvaTjamFxVm9+45KaJvc=; b=PI5UMxTQi0aJhPBs3PexwF4b7KNOjZxncevBSMAy/RUy8yRi6XZA9tVToC5KwmhARsOQ F/5qW1bWqMtvR7bnRAN9j5vGnoI3gfjycwJJ30eoHp13iSRt8DvMwiLiyQJDYs5TZQJ3 nVghV/ccjl6CIwTKBeewzmrZVXDQRscUTemvDrF1Q1T0KYEIbvry5t84Wcdr7BmjWxPi Z3HXu5yT0jNT9uJup3q7NOvuBmkcSPE46SMv1GXoEStILTK61Yel6nA7rYBcgAIjKER0 v1V34In3l4hYJtrJZqnD2etPIlTiTY0PIOPEPXyIcUAAyHxIB0dnpeJ6JZAWir2V35T9 nQ== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0a-00230701.pphosted.com (PPS) with ESMTPS id 3nyjfdwbnq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Mar 2023 08:12:20 -0800 Received: from mailhost.synopsys.com (sv1-mailhost2.synopsys.com [10.205.2.132]) (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 D279DC00AF; Thu, 2 Mar 2023 16:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1677773539; bh=ef2VQ9QkBlki0vk0yTeJwqC+VlwKiBF/Qb9jA+N3Jts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqMsLOZLUurkl6w7OLQFM9gkg2yfU4LqIWB6bzT7HSZZOA5WWSOQmRUdvSBOgYPUq b9MgAQ9PDAAatNBzm3JMTRxmK4grto+6WgHT3kbGWreX5v573gl3vFslcWLJg1BoxE qMwftf3e/4sYTtiz1xjppLp0rU/ff1ehLr5V2Y4fZDM+JS/KIUUp3Czrxn5F43Hz0P yexTZgRb0CGumF6IRMK33C9AKeyRhiuXdmw09YmB6TyHv74FPdlJ8MYkYsTRinvhC6 czWc2+xXJhJPLAdcBRukFx9BLwIWjUiZvJB6Nbzt0of70bTirKWSovmYwrVeWeQuHt NFE6736n8crnQ== Received: from SNPS-o0WHuHJU73.internal.synopsys.com (snps-o0whuhju73.internal.synopsys.com [10.116.105.29]) (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 E173AA006D; Thu, 2 Mar 2023 16:12:16 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Pavel.Kozlov@synopsys.com To: libc-alpha@sourceware.org Cc: linux-snps-arc@lists.infradead.org, Pavel Kozlov Subject: [PATCH 2/2] ARC: run child from the separate start block in __clone Date: Thu, 2 Mar 2023 20:10:19 +0400 Message-Id: <20230302161019.27192-2-kozlov@synopsys.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230302161019.27192-1-kozlov@synopsys.com> References: <20230302161019.27192-1-kozlov@synopsys.com> MIME-Version: 1.0 X-Proofpoint-GUID: YlCzq_bxQPRvZ3PwhbDVJxRjvxzMUMw8 X-Proofpoint-ORIG-GUID: YlCzq_bxQPRvZ3PwhbDVJxRjvxzMUMw8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-02_09,2023-03-02_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 lowpriorityscore=0 phishscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 malwarescore=0 adultscore=0 mlxlogscore=944 impostorscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303020140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230302_081220_721412_046796FF X-CRM114-Status: GOOD ( 15.92 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Pavel Kozlov For better debug experience use separate code block with extra cfi_* directives to run child (same as in __clone3). --- sysdeps/unix/sysv/linux/arc/clone.S | 40 ++++++++++++++++++ 1 file ch [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Pavel Kozlov For better debug experience use separate code block with extra cfi_* directives to run child (same as in __clone3). Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/arc/clone.S | 40 ++++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/sysdeps/unix/sysv/linux/arc/clone.S b/sysdeps/unix/sysv/linux/arc/clone.S index 766649625658..0029aaeb8170 100644 --- a/sysdeps/unix/sysv/linux/arc/clone.S +++ b/sysdeps/unix/sysv/linux/arc/clone.S @@ -20,9 +20,6 @@ #include #define _ERRNO_H 1 #include -#include - -#define CLONE_SETTLS 0x00080000 /* int clone(int (*fn)(void *), void *child_stack, int flags, void *arg, ... @@ -63,19 +60,9 @@ ENTRY (__clone) ARC_TRAP_INSN cmp r0, 0 /* return code : 0 new process, !0 parent. */ + beq thread_start_clone blt L (__sys_err2) /* < 0 (signed) error. */ - jnz [blink] /* Parent returns. */ - - /* child jumps off to @fn with @arg as argument - TP register already set by kernel. */ - jl.d [r10] - mov r0, r11 - - /* exit() with result from @fn (already in r0). */ - mov r8, __NR_exit - ARC_TRAP_INSN - /* In case it ever came back. */ - flag 1 + j [blink] /* Parent returns. */ L (__sys_err): mov r0, -EINVAL @@ -89,5 +76,28 @@ L (__sys_err2): position independent. */ b __syscall_error PSEUDO_END (__clone) + + + .align 4 + .type thread_start_clone, %function +thread_start_clone: + cfi_startproc + /* Terminate call stack by noting ra is undefined. */ + cfi_undefined (blink) + + /* Child jumps off to @fn with @arg as argument. */ + jl.d [r10] + mov r0, r11 + + /* exit() with result from @fn (already in r0). */ + mov r8, __NR_exit + ARC_TRAP_INSN + + /* In case it ever came back. */ + flag 1 + + cfi_endproc + .size thread_start_clone, .-thread_start_clone + libc_hidden_def (__clone) weak_alias (__clone, clone)