From patchwork Mon Aug 7 10:32:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Arsen_Arsenovi=C4=87?= X-Patchwork-Id: 131809 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1378121vqr; Mon, 7 Aug 2023 04:25:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKgqXjsTsG8zEkqWkZu45fADIpr9HJgpTApgRUB91D8LmlZ4khmdt+8WaF6tokcuC+skm0 X-Received: by 2002:a17:907:a06f:b0:994:13c3:2f89 with SMTP id ia15-20020a170907a06f00b0099413c32f89mr6959860ejc.27.1691407556606; Mon, 07 Aug 2023 04:25:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691407556; cv=none; d=google.com; s=arc-20160816; b=jiKwNP6Sewz/GvH5/GiHy+E8lS6iIfSL82MvhCJGuafaMiKegFTul/1yCcnRl7ETQo /emsKwRw+L3KugSVlNEZSaSzHiAi3SqA6rvGQcAMbacBCDRy+txdAq1xaZ8n/j2oLudY CINIJMEEsA6PMxjrlisLb9BacgG7Q+/1IKAhdkVtj7YNGs2l2ZnhKeM1U5EyKw/VYsfw J7dtly3514n9boUrCdIFWvHR/NkwmLHNojgzRmrg/E0bzyW4+LX1rc3oW+MgF+7AdxkT wg2xi+vyrw8XPvvqSU+rUeC/Imr1XWu/lVMpzL/O3979m6g0WElWCIcNKRjcPYeF/q9E WKDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=1OQ6VaJ3jUexPPXXTrfVpfXRw7I3rK/xbpEEfhaSbe8=; fh=dVJSUdZ7N+K4nORQS4wUpj9ufOHYE6mmeCsgjO6CLl4=; b=M7jFyHwez9lWlA4NpUPV+v12aS8/bRzjrUxqfBajjXjrcUSyqbou211fNopDEaIi6O t7ywwTS6HdzVOp8GCh16NmrL3Vp6/2g2MUMHbkF/HZSNPPdv/SBfv0CT0hMKFJ6UOPFE vldkb/VerS4z0VH4hyD4DvwkdwyeVDdZ6WG/6aWmVZLS57fHp3kG1CNdmfYc2LKvaPt7 HQK3jcMMu3pxxBbtKNRnOc/SEHHTI7GUssJqXZdKd1o+e9fCAXNijAsf/3uGbxxiODGT nXb7r8/elwoz3FwdiUyJRh3TNldo/TquCrpaL8WLXyzFu2LRuLSV56IANjjJjPWvAELh jdRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rvdRLdRF; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id j19-20020a170906255300b00991ece4c966si5715680ejb.101.2023.08.07.04.25.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 04:25:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rvdRLdRF; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 89DBF3870C07 for ; Mon, 7 Aug 2023 11:22:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89DBF3870C07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691407347; bh=1OQ6VaJ3jUexPPXXTrfVpfXRw7I3rK/xbpEEfhaSbe8=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=rvdRLdRF1YSNf5aELEpQ0orfsFzmDuj/fqqwzUo1U1ObAUHBg2ZLT/7k5VHVazCzb kuuvzdoa7r/PtNuKAE0Es68+AHSWPpCTxlftHZrvEwLFJSZLpqYxlxQz2hJQkZ3Tcs XAForI9zkj4VkD63XLaTQ4iAxCxFiwJr8zRdClz8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by sourceware.org (Postfix) with ESMTPS id AEF703857341 for ; Mon, 7 Aug 2023 11:19:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AEF703857341 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4RKDNl0K1fz9snG; Mon, 7 Aug 2023 13:19:19 +0200 (CEST) To: gcc-patches@gcc.gnu.org Cc: Luis Machado Subject: [PATCH 11/24] Disable year 2038 support on 32-bit hosts by default Date: Mon, 7 Aug 2023 12:32:53 +0200 Message-ID: <20230807105935.2098236-12-arsen@aarsen.me> In-Reply-To: <20230807105935.2098236-1-arsen@aarsen.me> References: <20230807105935.2098236-1-arsen@aarsen.me> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4RKDNl0K1fz9snG X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Arsen_Arsenovi=C4=87_via_Gcc-patches?= From: =?utf-8?q?Arsen_Arsenovi=C4=87?= Reply-To: =?utf-8?q?Arsen_Arsenovi=C4=87?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773569369660304491 X-GMAIL-MSGID: 1773569369660304491 From: Luis Machado 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. Thoughts? ChangeLog: * configure.ac: Disable year2038 by default on 32-bit hosts. * configure: Regenerate. --- configure | 22 ++++++++++++++++++++++ configure.ac | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/configure b/configure index 35c0c75ee12..faa1aedaa04 100755 --- a/configure +++ b/configure @@ -809,6 +809,7 @@ enable_ld enable_gprofng enable_compressed_debug_sections enable_default_compressed_debug_sections_algorithm +enable_year2038 enable_libquadmath enable_libquadmath_support enable_libada @@ -1552,6 +1553,7 @@ Optional Features: --enable-default-compressed-debug-sections-algorithm={zlib,zstd} Default compression algorithm for --enable-compressed-debug-sections. + --enable-year2038 enable support for timestamps past the year 2038 --disable-libquadmath do not build libquadmath directory --disable-libquadmath-support disable libquadmath support for Fortran @@ -3194,6 +3196,20 @@ case "${host}" in ;; esac +# Default to --disable-year2038 until we can handle differences between +# projects that use gnulib (which understands year 2038) and projects that +# do not (like BFD). +# Check whether --enable-year2038 was given. +if test "${enable_year2038+set}" = set; then : + enableval=$enable_year2038; ENABLE_YEAR2038=$enableval +else + ENABLE_YEAR2038=no +fi + +enable_year2038= +if test "${ENABLE_YEAR2038}" = "no" ; then + enable_year2038=no +fi # Check whether --enable-libquadmath was given. if test "${enable_libquadmath+set}" = set; then : @@ -10215,9 +10231,15 @@ if test "$silent" = yes; then baseargs="$baseargs --silent" tbaseargs="$tbaseargs --silent" fi + baseargs="$baseargs --disable-option-checking" tbaseargs="$tbaseargs --disable-option-checking" +if test "$enable_year2038" = no; then + baseargs="$baseargs --disable-year2038" + tbaseargs="$tbaseargs --disable-year2038" +fi + # Record and document user additions to sub configure arguments. diff --git a/configure.ac b/configure.ac index 71b923d316f..a0dff0ecac8 100644 --- a/configure.ac +++ b/configure.ac @@ -459,6 +459,18 @@ case "${host}" in ;; esac +# Default to --disable-year2038 until we can handle differences between +# projects that use gnulib (which understands year 2038) and projects that +# do not (like BFD). +AC_ARG_ENABLE(year2038, +AS_HELP_STRING([--enable-year2038], + [enable support for timestamps past the year 2038]), +ENABLE_YEAR2038=$enableval, +ENABLE_YEAR2038=no) +enable_year2038= +if test "${ENABLE_YEAR2038}" = "no" ; then + enable_year2038=no +fi AC_ARG_ENABLE(libquadmath, AS_HELP_STRING([--disable-libquadmath], @@ -3339,9 +3351,15 @@ if test "$silent" = yes; then baseargs="$baseargs --silent" tbaseargs="$tbaseargs --silent" fi + baseargs="$baseargs --disable-option-checking" tbaseargs="$tbaseargs --disable-option-checking" +if test "$enable_year2038" = no; then + baseargs="$baseargs --disable-year2038" + tbaseargs="$tbaseargs --disable-year2038" +fi + # Record and document user additions to sub configure arguments. AC_ARG_VAR([build_configargs], [additional configure arguments for build directories])