From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id E6E7138582B9; Mon, 1 Aug 2022 15:37:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E6E7138582B9 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 63D711E9EB; Mon, 1 Aug 2022 11:37:28 -0400 (EDT) Message-ID: <14374ca2-3979-f2d2-2296-a36ba9c615d2@simark.ca> Date: Mon, 1 Aug 2022 11:37:27 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] Disable year 2038 support on 32-bit hosts by default Content-Language: en-US To: Luis Machado , gdb-patches@sourceware.org, binutils@sourceware.org References: <20220801075149.1152064-1-luis.machado@arm.com> <959a19b9-b2c3-6638-e0b9-b66ca8328574@simark.ca> <4224183e-e2c1-9a98-7e41-61a58e49aa29@arm.com> From: Simon Marchi In-Reply-To: <4224183e-e2c1-9a98-7e41-61a58e49aa29@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2022 15:37:30 -0000 On 2022-08-01 10:17, Luis Machado wrote: > On 8/1/22 15:08, Simon Marchi wrote: >> >> >> On 2022-08-01 03:51, Luis Machado via Gdb-patches wrote: >>> With a recent import of gnulib, code has been pulled that tests and enables >>> 64-bit time_t by default on 32-bit hosts that support it. >>> >>> Although gdb can use the gnulib support, bfd doesn't use gnulib and currently >>> doesn't do these checks. >>> >>> As a consequence, if we have a 32-bit host that supports 64-bit time_t, we'll >>> have a mismatch between gdb's notion of time_t and bfd's notion of time_t. >>> >>> This will lead to mismatches in the struct stat size, leading to memory >>> corruption and crashes. >>> >>> This patch disables the year 2038 check for now, which makes things work >>> reliably again. >>> >>> I'd consider this a temporary fix until we have proper bfd checks for the year >>> 2038, if it makes sense. 64-bit hosts seems to be more common these days, so >>> I'm not sure how important it is to have this support enabled and how soon >>> we want to enable it. >> >> I don't understand: why offer a --enable-year2038 switch if using it >> would produce a broken build? > > That switch is already offered by gnulib since the recent import, and it is on by default. So in practice it produces a broken build for 32-bit hosts > running a distro that understands 64-bit time_t. It's been broken for a while now. Ah ok, I didn't understand that this configure switch was althread provided by gnulib. Makes sense. > What I'm suggesting is having a temporary fix so default builds aren't silently broken due to a mismatch in stat size between GDB and BFD. > > It isn't clear to me if we really want to switch to 64-bit time_t for 32-bit hosts at this point. There is potential for more breakage. My opinion would be to follow the trend and use 64-bit everywhere, and not have to worry about future-proofing anymore. But I don't have any stakes in this. Simon