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 291B53858425 for ; Thu, 22 Feb 2024 14:04:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 291B53858425 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 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 291B53858425 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708610691; cv=none; b=c7ZW3VwBOJ3+Ys2Ky5FWmbUf70U5quatJfS0dJLFQvSTwCyCqfa0C39V2jafTJ0nETqQz3CTlBqaEykDT2oOtODFI+e547SL3zPqozZM3/An46pYe+osaURPyG8W9h9mlLmpzz30vYK32AUs7E/6dbPw+BINh47bah3HN3VyBX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708610691; c=relaxed/simple; bh=ZAvbjQl09IPsRKzaxiHrcEAGMwLCjIN3MWP8djFJRDI=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=ePnIC6mGJuzlX/9YS7IhOUyqiUrcEf/0JVDSUeYjkwIOYNk6gUelQu61AyjKYyAcGnTRGxKBOLBYwfKLtCayDlUkhgg9OZsmge7gxdWnIM9Zda/Bz6m5MVPxqae/wvrEHTN0W3QrzjSqk2YbbqzlwatZMPPnvOEwhU5UIDkKkHw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MCqeH3010135; Thu, 22 Feb 2024 14:04:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=GP1D1GWeiLAVcUrnm2gcfGcuH9PzJR5R4TdrKZi1OKU=; b=Z6wKb1cBA2KPww93Ap8Kd+Jts3VvX+79YineDuBAM39YUUpSvC8pPqlobuqstJNU9dkq zdIso8MdqRShH6A9WnFji73EzW7FyJzrswClt8UCoKbZkyO8BfYysGJhoIlwiAXHTCZx K6Us3iSXcZEoJrljlisfZpYAdg6yMUmJuw24cTX82C1rawr+WV3zrXcMzZnGJjtMtCxF N57M9+4twhIx7wbAAiPrCKAHkB1pr+AqFgM/ScogVdhj+ay1BaUet23UHWdRf4NmOftl aX/9Jh1o7O2EUF3wn0+Jni4tSLmUSFsQgKBPcNeiE7OmqFdlCIN+u/lzeNtV3voL6szz mA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3we6ngja6p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 14:04:37 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MDpaJM026674; Thu, 22 Feb 2024 14:04:36 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3we6ngja5p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 14:04:36 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41MCP0PJ009627; Thu, 22 Feb 2024 14:04:35 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wb84ppjgd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 14:04:35 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41ME4VtD5964424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 14:04:33 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5034C2004E; Thu, 22 Feb 2024 14:04:31 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F13B20043; Thu, 22 Feb 2024 14:04:31 +0000 (GMT) Received: from [9.171.28.254] (unknown [9.171.28.254]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 22 Feb 2024 14:04:30 +0000 (GMT) Message-ID: Date: Thu, 22 Feb 2024 15:04:30 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] S390: Do not clobber r7 in clone [BZ #31402] To: Jakub Jelinek Cc: libc-alpha@sourceware.org, schwab@linux-m68k.org References: <20240221161307.2821102-1-stli@linux.ibm.com> Content-Language: en-US From: Stefan Liebler In-Reply-To: Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: si2nSzZz3ANOqdh4j-BTwrTxqOlSu9X_ X-Proofpoint-GUID: k9FLLpCyxqUyfShQVCJT9OwCw2kwrbPd Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_11,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=811 clxscore=1015 impostorscore=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220112 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On 21.02.24 17:31, Jakub Jelinek wrote: > On Wed, Feb 21, 2024 at 05:13:07PM +0100, Stefan Liebler wrote: >> Starting with commit e57d8fc97b90127de4ed3e3a9cdf663667580935 >> "S390: Always use svc 0" >> clone clobbers the call-saved register r7 in error case: >> function or stack is NULL. >> >> This patch restores the saved registers also in the error case. > > You could also just restore just %r7 and not both %r6 and %r7, > because only %r7 has been modified. But no idea what is actually > faster (and if equally fast what is smaller), especially when the > saving has been done using stm/stmg of the pair. Yes, you are right, restoring r7 is enough. Nevertheless I prefer that the error-label is equal to the remaining code. > > Also, wonder if there shouldn't be a testcase covering it, just > call clone (NULL, NULL, ...) and verify that it returned < 0/EINVAL > and try to create high register preassure in the function across the > call and make sure it fails without the patch and succeeds with it? > > Like below, though it will need to be adjusted for the glibc ways of doing > testcases (instead of abort do what is usual for test failures, etc.), > plus make sure it is tested only on arches which actually have clone (i.e. > Linux). I've extended the already existing testcase for all error cases and added your suggested register clobber test. It fails without the fix and passes with it. Here is V2: [PATCH v2] S390: Do not clobber r7 in clone [BZ #31402] https://sourceware.org/pipermail/libc-alpha/2024-February/154911.html > > #define _GNU_SOURCE > #include > #include > #include > #include > > volatile unsigned v = 0xdeadbeef; > > int > main () > { > unsigned int a = v; > unsigned int b = v; > unsigned int c = v; > unsigned int d = v; > unsigned int e = v; > unsigned int f = v; > unsigned int g = v; > unsigned int h = v; > unsigned int i = v; > unsigned int j = v; > unsigned int k = v; > unsigned int l = v; > unsigned int m = v; > unsigned int n = v; > unsigned int o = v; > if (clone (NULL, NULL, SIGCHLD, NULL) >= 0 || errno != EINVAL) > abort (); > if (a != v || b != v || c != v || d != v || e != v > || f != v || g != v || h != v || i != v || j != v > || k != v || l != v || m != v || n != v || o != v) > abort (); > } > > Jakub >