From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id ACD72385840E for ; Wed, 16 Feb 2022 23:07:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ACD72385840E Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21GM8VY5031316 for ; Wed, 16 Feb 2022 23:07:56 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e98yn9v4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 16 Feb 2022 23:07:56 +0000 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21GN7alx016974 for ; Wed, 16 Feb 2022 23:07:55 GMT Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e98yn9v47-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 23:07:55 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21GN0ok0025928; Wed, 16 Feb 2022 23:02:55 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma05wdc.us.ibm.com with ESMTP id 3e64hbjjq5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Feb 2022 23:02:55 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21GN2q1D12976780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Feb 2022 23:02:52 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BFBD7C60ED; Wed, 16 Feb 2022 23:02:52 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 559DBC6067; Wed, 16 Feb 2022 23:02:52 +0000 (GMT) Received: from [9.160.1.69] (unknown [9.160.1.69]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 16 Feb 2022 23:02:52 +0000 (GMT) Message-ID: Date: Wed, 16 Feb 2022 17:02:51 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 2/5] [PowerPC64] Set up thread register for _dl_relocate_static_pie Content-Language: en-US To: Alan Modra , libc-alpha@sourceware.org Cc: Tulio Magno Quites Machado Filho References: From: Paul E Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3KYFujQ53ms-aP5INx-9ei833-eptVPF X-Proofpoint-ORIG-GUID: 6f08rkbgG2iU05DmvyIobz1QSkIxnxy0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-16_11,2022-02-16_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 impostorscore=0 spamscore=0 phishscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202160125 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2022 23:08:01 -0000 On 1/23/22 9:47 PM, Alan Modra via Libc-alpha wrote: > On Sun, Jan 23, 2022 at 11:12:13PM +1030, Alan Modra wrote: >> There's a serious problem in libgcc too. libgcc ifuncs access the >> AT_HWCAP words stored in the tcb with an offset from the thread >> pointer (r13), but r13 isn't set at the time _dl_relocate_static_pie >> runs, and I'm loathe to try calling init_tls early. A better approach >> that might work is to fake r13 so that _dl_hwcap is at the expected >> offset where we'd normally find the tcb hwcap words. > > Like this. > > libgcc ifunc resolvers that access hwcap via a field in the tcb can't > be called until the thread pointer is set up. This patch sets up a > fake thread pointer early so that static-pies won't segfault on > attempting to relocate themselves. > I suspect the thread pointer needs to be setup more. How much, I am not sure. Looking into the failure of tst-tlsifunc-static, we would need similar access to at_platform when resolving ifunc for similar reasons of hwcap. That seems like an easy fix. However, I am not sure what to make of the other failure in this test. A pointer into tls is created as part of running an ifunc resolver. Do we need to preserve that behavior?