Message ID | 20210329133557.185178-1-msc@linux.ibm.com |
---|---|
State | Committed |
Headers |
Return-Path: <libc-alpha-bounces@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 9A1A83857026; Mon, 29 Mar 2021 13:36:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A1A83857026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1617024977; bh=KnkLHPmoItQ7ZCUmWZx1kwVa7/ci1GCxw1CSmhCqvc0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=JhF+WGFkLyT9C61/ciGelNwU+9if1W1J7hfeOLIe7TIASluyAwIdZmkxStv40czZ8 ss3zuN8JVO4rcGsUJvCOJarX6zjRhu+0VaKH8DX60zvfHShiW0aL9cdhYLS+8geLP5 oV4Zf+bf4GySBIQKU0IHb7/HDGuerXuCyOMKZGTI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id DBDF33858002 for <libc-alpha@sourceware.org>; Mon, 29 Mar 2021 13:36:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DBDF33858002 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12TDXF5E089292; Mon, 29 Mar 2021 09:36:11 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 37jhsar8hn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Mar 2021 09:36:11 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12TDXmN1093337; Mon, 29 Mar 2021 09:36:10 -0400 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 37jhsar8cq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Mar 2021 09:36:10 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12TDZSPw007020; Mon, 29 Mar 2021 13:36:00 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma02wdc.us.ibm.com with ESMTP id 37hvb96pjp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 29 Mar 2021 13:36:00 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12TDZxTN22610308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 29 Mar 2021 13:35:59 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CFB57805C; Mon, 29 Mar 2021 13:35:59 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C269B78064; Mon, 29 Mar 2021 13:35:58 +0000 (GMT) Received: from localhost (unknown [9.65.241.79]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 29 Mar 2021 13:35:58 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH v2] powerpc: Add missing registers to clobbers list for syscalls [BZ #27623] Date: Mon, 29 Mar 2021 10:35:57 -0300 Message-Id: <20210329133557.185178-1-msc@linux.ibm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: vjWWCEFfVz8V6sZt5fqpd6q08XEVGsG5 X-Proofpoint-GUID: nCujOONRAKviEQDJ9FljfxvcfvaqIrl2 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-29_09:2021-03-26, 2021-03-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 clxscore=1015 adultscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 mlxscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103250000 definitions=main-2103290103 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 <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: Matheus Castanho via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Matheus Castanho <msc@linux.ibm.com> Cc: tuliom@linux.ibm.com, schwab@linux-m68k.org, npiggin@gmail.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
[v2] powerpc: Add missing registers to clobbers list for syscalls [BZ #27623]
|
|
Commit Message
Matheus Castanho
March 29, 2021, 1:35 p.m. UTC
Some registers that can be clobbered by the kernel during a syscall are not listed on the clobbers list in sysdeps/unix/sysv/linux/powerpc/sysdep.h. For syscalls using sc: - XER is zeroed by the kernel on exit For syscalls using scv: - XER is zeroed by the kernel on exit - Different from the sc case, most CR fields can be clobbered (according to the ELF ABI and the Linux kernel's syscall ABI for powerpc (linux/Documentation/powerpc/syscall64-abi.rst) The same should apply to vsyscalls, which effectively execute a function call but are not currently adding these registers as clobbers either. These are likely not causing issues today, but they should be added to the clobbers list just in case things change on the kernel side in the future. Reported-by: Nicholas Piggin <npiggin@gmail.com> --- Changes from v1: - Add XER, CR1, CR5-7 to vsyscall clobbers list --- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.30.2
Comments
Excerpts from Matheus Castanho's message of March 29, 2021 11:35 pm: > Some registers that can be clobbered by the kernel during a syscall are not > listed on the clobbers list in sysdeps/unix/sysv/linux/powerpc/sysdep.h. > > For syscalls using sc: > - XER is zeroed by the kernel on exit > > For syscalls using scv: > - XER is zeroed by the kernel on exit > - Different from the sc case, most CR fields can be clobbered (according to > the ELF ABI and the Linux kernel's syscall ABI for powerpc > (linux/Documentation/powerpc/syscall64-abi.rst) > > The same should apply to vsyscalls, which effectively execute a function call > but are not currently adding these registers as clobbers either. > > These are likely not causing issues today, but they should be added to the > clobbers list just in case things change on the kernel side in the future. > > Reported-by: Nicholas Piggin <npiggin@gmail.com> As far as I can tell, this should be matching the kernel now. Thanks, Nick > --- > > Changes from v1: > - Add XER, CR1, CR5-7 to vsyscall clobbers list > > --- > sysdeps/unix/sysv/linux/powerpc/sysdep.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h > index 6b99464e61..2f31f9177b 100644 > --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h > +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h > @@ -56,7 +56,9 @@ > "0:" \ > : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ > "+r" (r7), "+r" (r8) \ > - : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ > + : : "r9", "r10", "r11", "r12", \ > + "cr0", "cr1", "cr5", "cr6", "cr7", \ > + "xer", "lr", "ctr", "memory"); \ > __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ > (long int) r0 & (1 << 28) ? -rval : rval; \ > }) > @@ -86,7 +88,8 @@ > "=&r" (r6), "=&r" (r7), "=&r" (r8) \ > : ASM_INPUT_##nr \ > : "r9", "r10", "r11", "r12", \ > - "lr", "ctr", "memory"); \ > + "cr0", "cr1", "cr5", "cr6", "cr7", \ > + "xer", "lr", "ctr", "memory"); \ > r3; \ > }) > > @@ -101,7 +104,7 @@ > "=&r" (r6), "=&r" (r7), "=&r" (r8) \ > : ASM_INPUT_##nr \ > : "r9", "r10", "r11", "r12", \ > - "cr0", "ctr", "memory"); \ > + "xer", "cr0", "ctr", "memory"); \ > r0 & (1 << 28) ? -r3 : r3; \ > }) > > -- > 2.30.2 >
The patch LGTM! On 29/03/2021 10:35, Matheus Castanho via Libc-alpha wrote: > Some registers that can be clobbered by the kernel during a syscall are not > listed on the clobbers list in sysdeps/unix/sysv/linux/powerpc/sysdep.h. > > For syscalls using sc: > - XER is zeroed by the kernel on exit > > For syscalls using scv: > - XER is zeroed by the kernel on exit > - Different from the sc case, most CR fields can be clobbered (according to > the ELF ABI and the Linux kernel's syscall ABI for powerpc > (linux/Documentation/powerpc/syscall64-abi.rst) > > The same should apply to vsyscalls, which effectively execute a function call > but are not currently adding these registers as clobbers either. > > These are likely not causing issues today, but they should be added to the > clobbers list just in case things change on the kernel side in the future. > > Reported-by: Nicholas Piggin <npiggin@gmail.com> > --- > > Changes from v1: > - Add XER, CR1, CR5-7 to vsyscall clobbers list > > --- > sysdeps/unix/sysv/linux/powerpc/sysdep.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h > index 6b99464e61..2f31f9177b 100644 > --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h > +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h > @@ -56,7 +56,9 @@ > "0:" \ > : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ > "+r" (r7), "+r" (r8) \ > - : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ > + : : "r9", "r10", "r11", "r12", \ > + "cr0", "cr1", "cr5", "cr6", "cr7", \ > + "xer", "lr", "ctr", "memory"); \ > __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ > (long int) r0 & (1 << 28) ? -rval : rval; \ > }) > @@ -86,7 +88,8 @@ > "=&r" (r6), "=&r" (r7), "=&r" (r8) \ > : ASM_INPUT_##nr \ > : "r9", "r10", "r11", "r12", \ > - "lr", "ctr", "memory"); \ > + "cr0", "cr1", "cr5", "cr6", "cr7", \ > + "xer", "lr", "ctr", "memory"); \ > r3; \ > }) > > @@ -101,7 +104,7 @@ > "=&r" (r6), "=&r" (r7), "=&r" (r8) \ > : ASM_INPUT_##nr \ > : "r9", "r10", "r11", "r12", \ > - "cr0", "ctr", "memory"); \ > + "xer", "cr0", "ctr", "memory"); \ > r0 & (1 << 28) ? -r3 : r3; \ > }) > > -- > 2.30.2 > Best Regards,
Pushed as 5d61fc2021922b4f572be218dad5b299e2939346 -- Matheus Castanho
diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index 6b99464e61..2f31f9177b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -56,7 +56,9 @@ "0:" \ : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ "+r" (r7), "+r" (r8) \ - : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ + : : "r9", "r10", "r11", "r12", \ + "cr0", "cr1", "cr5", "cr6", "cr7", \ + "xer", "lr", "ctr", "memory"); \ __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ (long int) r0 & (1 << 28) ? -rval : rval; \ }) @@ -86,7 +88,8 @@ "=&r" (r6), "=&r" (r7), "=&r" (r8) \ : ASM_INPUT_##nr \ : "r9", "r10", "r11", "r12", \ - "lr", "ctr", "memory"); \ + "cr0", "cr1", "cr5", "cr6", "cr7", \ + "xer", "lr", "ctr", "memory"); \ r3; \ }) @@ -101,7 +104,7 @@ "=&r" (r6), "=&r" (r7), "=&r" (r8) \ : ASM_INPUT_##nr \ : "r9", "r10", "r11", "r12", \ - "cr0", "ctr", "memory"); \ + "xer", "cr0", "ctr", "memory"); \ r0 & (1 << 28) ? -r3 : r3; \ })