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 171633857C5C for ; Wed, 12 Jan 2022 16:07:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 171633857C5C Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20CFqOPn015680; Wed, 12 Jan 2022 16:07:31 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dj20j09ya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 16:07:31 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 20CFx0gE021387; Wed, 12 Jan 2022 16:07:29 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 3df289dea7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 16:07:29 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20CG7QhW28901840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jan 2022 16:07:26 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DEB7A4060; Wed, 12 Jan 2022 16:07:26 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7123FA4069; Wed, 12 Jan 2022 16:07:26 +0000 (GMT) Received: from [9.145.18.11] (unknown [9.145.18.11]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 12 Jan 2022 16:07:26 +0000 (GMT) Message-ID: Date: Wed, 12 Jan 2022 17:07:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v2] Use LFS and 64 bit time for installed programs (BZ #15333) Content-Language: en-US To: Adhemerval Zanella , libc-alpha@sourceware.org References: <8699437a-bb09-9b62-0302-10434d4aa18f@linaro.org> From: Stefan Liebler In-Reply-To: <8699437a-bb09-9b62-0302-10434d4aa18f@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: u6raNQTycet8U-muCNp2-NPmsZBjwKjX X-Proofpoint-ORIG-GUID: u6raNQTycet8U-muCNp2-NPmsZBjwKjX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_04,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 mlxscore=0 malwarescore=0 spamscore=0 impostorscore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120103 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 12 Jan 2022 16:07:37 -0000 On 12/01/2022 15:44, Adhemerval Zanella wrote: > > > On 12/01/2022 11:13, Stefan Liebler wrote: >> On 14/12/2021 20:35, DJ Delorie via Libc-alpha wrote: >> ... >>> >>> LGTM >>> Reviewed-by: DJ Delorie >>> >> >> Starting with this commit a6d2f948b71adcb5ea395cb04833bc645eab45e6, I >> get a test fail on s390: >> FAIL: resolv/tst-p_secstodate >> >> Test 0: 0 -> 19700101000000 >> Test 1: 12345 -> 19700101000000 >> test 1 failedTest 2: 999999999 -> 19700101000000 >> test 2 failedTest 3: 2147483647 -> 19700101000000 >> test 3 failedTest 4: 2147483648 -> >> Test 5: 4294967295 -> >> >> It turns out that there is a type-mismatch of time_t on caller and >> callee side. >> >> in libresolv.so: resolv/res_debug.c: __p_secstodate(u_long secs) >> time_t clock = secs; >> struct tm *time = __gmtime_r(&clock, &timebuf); >> >> (gdb) p &clock >> $1 = (time_t *) 0x7ffff1c8 >> (gdb) ptype time_t >> type = long long >> (gdb) p sizeof(time_t) >> $2 = 8 >> (gdb) x/2xw 0x7ffff1c8 >> 0x7ffff1c8: 0x00000000 0x7fffffff >> >> The secs are stored as 8byte long long on stack and the pointer is >> passed to __gmtime_r in libc.so: >> time/gmtime.c: >> /* Provide a 32-bit variant if needed. */ >> #if __TIMESIZE != 64 >> struct tm * >> __gmtime_r (const time_t *t, struct tm *tp) >> { >> __time64_t t64 = *t; >> return __gmtime64_r (&t64, tp); >> } >> #endif >> >> (gdb) ptype time_t >> type = long >> (gdb) p sizeof(time_t) >> $3 = 4 >> (gdb) p *t >> $4 = 0 >> (gdb) ptype __time64_t >> type = long long >> >> On libc.so side, time_t is defined as 4byte long, thus the value of t is >> read as 0x0 instead of 0x7fffffff. >> >> resolv/res_debug.c is built with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 >> and time/gmtime.c is built without those defines. >> >> >> @Adhemerval: >> Can you please have a look? > > > libresolv should not be built with the time64 flags, the above patch should fix > it. > > diff --git a/Makeconfig b/Makeconfig > index 06f1cca320..9b6fc6b08f 100644 > --- a/Makeconfig > +++ b/Makeconfig > @@ -867,7 +867,7 @@ endif > +extra-math-flags = $(if $(filter libm,$(in-module)),-fno-math-errno,-fmath-errno) > > # Use 64 bit time_t support for installed programs > -installed-modules = nonlib nscd lddlibc4 libresolv ldconfig locale_programs \ > +installed-modules = nonlib nscd lddlibc4 ldconfig locale_programs \ > iconvprogs libnss_files libnss_compat libnss_db libnss_hesiod \ > libutil libpcprofile libSegFault > +extra-time-flags = $(if $(filter $(installed-modules),\ > > I have this issue on my backlog since I saw it on powerpc32. I will check on > i686 and powerpc and install it. Thanks for the commit. This fixes the failing test.