From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id D9E4D385DC1A for ; Tue, 26 Jan 2021 14:45:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D9E4D385DC1A Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 10QEDaWg046193 for ; Tue, 26 Jan 2021 09:45:02 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 36amnarvm5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 26 Jan 2021 09:45:02 -0500 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 10QEFRpM052591 for ; Tue, 26 Jan 2021 09:45:02 -0500 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 36amnarvkm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Jan 2021 09:45:02 -0500 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 10QEbj0N025425; Tue, 26 Jan 2021 14:45:01 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma03wdc.us.ibm.com with ESMTP id 36a0t2etvb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Jan 2021 14:45:01 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 10QEj0l810224424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Jan 2021 14:45:00 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D3257124055; Tue, 26 Jan 2021 14:45:00 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A67D3124054; Tue, 26 Jan 2021 14:45:00 +0000 (GMT) Received: from [9.80.199.147] (unknown [9.80.199.147]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 26 Jan 2021 14:45:00 +0000 (GMT) Subject: Re: [PATCH] powerpc64: Workaround sigtramp vdso return call. To: Florian Weimer , libc-alpha@sourceware.org References: <20210126130515.jivsqeoyj5nu5znk@work-tp> <8735ynbxe6.fsf@oldenburg.str.redhat.com> From: Paul E Murphy Message-ID: <92b0ba5f-082c-5d4d-7998-075973fb32f6@linux.ibm.com> Date: Tue, 26 Jan 2021 08:45:00 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <8735ynbxe6.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-26_07:2021-01-26, 2021-01-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 mlxscore=0 suspectscore=0 phishscore=0 impostorscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101260076 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Tue, 26 Jan 2021 14:45:05 -0000 On 1/26/21 8:12 AM, Florian Weimer via Libc-alpha wrote: > * Raoni Fassina Firmino: > >> A not so recent kernel change[1] changed how the trampoline >> `__kernel_sigtramp_rt64` is used to call signal handlers. >> >> This was exposed on the test misc/tst-sigcontext-get_pc >> >> Before kernel 5.9, the kernel set LR to the trampoline address and >> jumped directly to the signal handler, and at the end the signal >> handler, as any other function, would `blr` to the address set. In >> other words, the trampoline was executed just at the end of the signal >> handler and the only thing it did was call sigreturn. But since >> kernel 5.9 the kernel set CTRL to the signal handler and calls to the >> trampoline code, the trampoline then `bctrl` to the address in CTRL, >> setting the LR to the next instruction in the middle of the >> trampoline, when the signal handler returns, the rest of the >> trampoline code executes the same code as before. > > Thanks for the patch, byt: > > No one has explained so far why the original blr instruction couldn't be > augmented with the appropriate branch predictor hint. The 2.07 ISA > manual suggests that it's possible, but maybe I'm reading it wrong. bctrl is the preferred form of making indirect calls. You can add hint 0b01 to bclr (blr) to get similar behavior on power8/9, but as noted in the ISA, it is optional.