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 BE7D53858D39 for ; Mon, 6 Mar 2023 09:27:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE7D53858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3268ZSiq032062; Mon, 6 Mar 2023 09:27:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : to : cc : from : subject : content-type : content-transfer-encoding; s=pp1; bh=7bNEBZMLINQiWKo1wQTIyr/bQ3Z4xdGdqn7gD/JoEPI=; b=jAzBrP9njVDCtmLFDv9mPtAovwnWco0Wz2QlNIisnRA/phXhM3YAdYZS8hLEMc2iCYvq f2WI8NmweX+Vz3T//LPnsVBUafLsWJlZ3qA4OxbpaZ2zCBxzzh3Kzg9WSWCXXz2qGcCC DI7Sa57Hed9up5j0bRXKSUSAHYSypV3xgfEc1UIIGLJYe21hE7qOxwwMZKhvKKBUkiIq H9l9GuadQ5bM8YvS4Z+JRZq5eD6QfyzYydvLJzYPqnKNj22qdWF3aIzl1ajZLWl/TetR Z2FLMZMfGdDa8DQiqWduE7m9mNuo0fXj1rzji/vwrLrz1Munu5bTcR32FW+bw/8PD4CB WQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3p4x1hgwp1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 09:27:18 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3269M215023535; Mon, 6 Mar 2023 09:27:17 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3p4x1hgwne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 09:27:17 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 325JulJp005927; Mon, 6 Mar 2023 09:27:15 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3p418ctfx7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 09:27:15 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3269RDDj29819342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Mar 2023 09:27:13 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EBE4E2004F; Mon, 6 Mar 2023 09:27:12 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9A1820043; Mon, 6 Mar 2023 09:27:10 +0000 (GMT) Received: from [9.197.230.12] (unknown [9.197.230.12]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 6 Mar 2023 09:27:10 +0000 (GMT) Message-ID: Date: Mon, 6 Mar 2023 17:27:09 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: GCC Patches Cc: Segher Boessenkool , David Edelsohn , AlanM , Peter Bergner From: "Kewen.Lin" Subject: [PATCH] rs6000, libgcc: Fix bump size for powerpc64 elfv1 ABI [PR108727] Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: kVmpWHPOj1SXMY3NDgFD5gz6-VhwxAs- X-Proofpoint-ORIG-GUID: Ih8fsOGI2teReLbq5y8yxcx2_ldLDyQD 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-06_02,2023-03-03_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=932 spamscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303060078 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,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 List-Id: Hi, As PR108727 shows, when cleanup code called by the stack unwinder calls function _Unwind_Resume, it goes via plt stub like: function 00000000.plt_call._Unwind_Resume: => 0x0000000010003580 <+0>: std r2,40(r1) 0x0000000010003584 <+4>: ld r12,-31760(r2) 0x0000000010003588 <+8>: mtctr r12 0x000000001000358c <+12>: ld r2,-31752(r2) 0x0000000010003590 <+16>: cmpldi r2,0 0x0000000010003594 <+20>: bnectr+ 0x0000000010003598 <+24>: b 0x100031a4 <_Unwind_Resume@plt> It wants to save TOC base (r2) to r1 + 40, but we only bump the stack segment by 32 bytes as follows: stdu %r29,-32(%r3) It means the access is out of the stack segment allocated by __generic_morestack, once the touch area isn't writable like this failure shows, it would cause segment fault. So fix the bump size with one reasonable value PARAMS. Bootstrapped and regtested on powerpc64-linux-gnu P{8,9} and powerpc64le-linux-gnu P{8,9,10}. Alan ack'ed this in that PR, I'm going to push this soon. BR, Kewen ----- PR libgcc/108727 libgcc/ChangeLog: * config/rs6000/morestack.S (__morestack): Use PARAMS for new stack bump size. --- libgcc/config/rs6000/morestack.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgcc/config/rs6000/morestack.S b/libgcc/config/rs6000/morestack.S index 5e7ad133303..f2fea6abb10 100644 --- a/libgcc/config/rs6000/morestack.S +++ b/libgcc/config/rs6000/morestack.S @@ -205,12 +205,12 @@ ENTRY0(__morestack) bl JUMP_TARGET(__generic_morestack) # Start using new stack - stdu %r29,-32(%r3) # back-chain + stdu %r29,-PARAMS(%r3) # back-chain mr %r1,%r3 # Set __private_ss stack guard for the new stack. ld %r12,NEWSTACKSIZE_SAVE(%r29) # modified size - addi %r3,%r3,BACKOFF-32 + addi %r3,%r3,BACKOFF-PARAMS sub %r3,%r3,%r12 # Note that a signal frame has $pc pointing at the instruction # where the signal occurred. For something like a timer -- 2.39.2