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 28D303858D20 for ; Fri, 5 May 2023 10:15:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 28D303858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=linux.vnet.ibm.com 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 345A6Q4S025057; Fri, 5 May 2023 10:15:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=nIeBsZ+l4/Xqh4+qCfJx0NAizWZGSJD4AXV02XCd8xE=; b=N9/eYa3JXm6R9tDEaRUAZCM3qMry+oNogiQ3zJFjhDI5lQSS0im77gF+qPyhnbTprW0r 1gbTV4RyCztTRtf1vp6uHySJ0P/S/m1ST3X9qAzn0YAXtgrXdAmKqy2wofKU7esPq5E7 Z310Gwzb59lGoUfJheLlsoKiUQKt14sHtjJXQAZ5C0Cg8IRkZVEMMzMkEb89qI7TmzjG s6zE+B8Gp2Cb5VSyrOJiSmPPo29W83AZ9ojzyKEhaIyeCjSThX9svZQrz72xmAII/WXp LN5KOy3an21tJUmKUGNN/OzfE0nY3lKDebC8TSr7KdB6EGXk8md14WunPOFX9hWnj29X yw== Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qcxkfaa76-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 May 2023 10:15:16 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3457oCEf005224; Fri, 5 May 2023 10:15:16 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([9.208.129.114]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3q8tv8nhh4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 05 May 2023 10:15:16 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 345AFDfV29426028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 May 2023 10:15:14 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CCEC958056; Fri, 5 May 2023 10:15:13 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E2F558060; Fri, 5 May 2023 10:15:12 +0000 (GMT) Received: from [9.43.61.243] (unknown [9.43.61.243]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Fri, 5 May 2023 10:15:11 +0000 (GMT) Message-ID: Date: Fri, 5 May 2023 15:45:10 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH] powerpc: Use sysconf (_SC_SIGSTKSZ) to set SIGSTKSZ and MINSIGSTKSZ. To: Tulio Magno Quites Machado Filho , Manjunath Matti via Libc-alpha Cc: rajis@linux.ibm.com, Manjunath Matti References: <20230424105208.301614-1-mmatti@linux.ibm.com> <874jozevbl.fsf@ascii.art.br> <7620a9b1-fe92-0764-6011-81d3a19e5590@linux.vnet.ibm.com> <871qjxe26c.fsf@ascii.art.br> From: Manjunath S Matti In-Reply-To: <871qjxe26c.fsf@ascii.art.br> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 5-Hgtv1R3F7-8J4IyvQBzxzMet_OdNnS X-Proofpoint-GUID: 5-Hgtv1R3F7-8J4IyvQBzxzMet_OdNnS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-05_16,2023-05-04_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 suspectscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxlogscore=966 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305050083 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 03/05/23 11:18 pm, Tulio Magno Quites Machado Filho wrote: > Manjunath S Matti writes: > >> On 28/04/23 11:35 pm, Tulio Magno Quites Machado Filho wrote: >>> Manjunath Matti via Libc-alpha writes: >>> >>>> +/* Minimum stack size for a signal handler: SIGSTKSZ/4. */ >>>> +# undef MINSIGSTKSZ >>>> +# define MINSIGSTKSZ (SIGSTKSZ >> 2) >>>> +#endif >>> I didn't understand this part. >>> Why SIGSTKSZ/4 ? I know this is correct now, but I think the kernel is >>> allowed to use another value. >>> Why is this part not using sysconf(_SC_MINSIGSTKSZ)? >>> I'm not suggesting to use sysconf() here, but I'm trying to understand >>> why the same source of value for both SIGSTKSZ and MINSIGSTKSZ is not >>> being used. >> In file: sysdeps/unix/sysv/linux/sysconf-sigstksz.h >> >>  28   if (minsigstacksize < MINSIGSTKSZ) >>  29     minsigstacksize = MINSIGSTKSZ; >>  30   /* MAX (MINSIGSTKSZ, sysconf (_SC_MINSIGSTKSZ)) * 4.  */ >>  31   long int sigstacksize = minsigstacksize * 4; >> >> So we are not changing the default implementation. > I'm not sure I understood you. Are you trying to tell me that you want > sysconf_sigstksz() to continue to return the same result? Do you want me to implement a powerpc specific function ? > If this is the case, be careful with the creation of > sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h because it is an > installed header. That means the values that are being set here will leak > to user code if __USE_DYNAMIC_STACK_SIZE is defined. > > If that happens, user code may end up having > MINSIGSTKSZ != getauxval(AT_MINSIGSTKSZ) if the kernel decides to change > the value of AT_MINSIGSTKSZ. My observation is that, MINSIGSTKSZ is not the same as getauxval(AT_MINSIGSTKSZ). Either in case of PowerPC or in case of x86. Let me try to explain getauxval(AT_MINSIGSTKSZ) returns 4224 which is the signal frame size in the kernel commit 63dee5df43a31f3844efabc58972f0a206ca4534 , whereas commit 2f82ec19757f58549467db568c56e7dfff8af283 Increase MINSIGSTKSZ to 8192. So MINSIGSTKSZ cannot take a value less than 8192,  testcase "signal/tst-minsigstksz-5.c" fails. Similar behaviour has been observed in x86, both getauxval(AT_MINSIGSTKSZ) and sysconf (_SC_MINSIGSTKSZ) return 1776 and MINSIGSTKSZ is 8192. >>> If we reach consensus that both macros in this file can have values set >>> at runtime, then I it might be worth adding a test in order to check that >>> dl_minsigstacksize, MINSIGSTKSZ and AT_MINSIGSTKSZ passed by the kernel >>> are identical. >>> >> There are testcases which already use MINSIGSTKSZ >> >> sysdeps/pthread/tst-signal6.c >> >> signal/tst-minsigstksz-5.c > AFAICS none of these tests are checking if dl_minsigstacksize, MINSIGSTKSZ and > AT_MINSIGSTKSZ have identical values. > AFAIU, at least on powerpc, they should always be identical. > Having such a test would help: > - to signal if the kernel changes it without a warning. > - if another commit changed one of them by mistake. > > AFAIU, the tests you pointed out help to identify if the current sizes > are indeed enough to handle signals, which is also very important. > As per the above explaination, MINSIGSTKSZ and sysconf (_SC_MINSIGSTKSZ) do not have the same values.