public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Disable year 2038 support on 32-bit hosts by default
@ 2022-08-01  7:51 Luis Machado
  2022-08-01 14:08 ` Simon Marchi
  2022-08-08 14:51 ` Nick Clifton
  0 siblings, 2 replies; 22+ messages in thread
From: Luis Machado @ 2022-08-01  7:51 UTC (permalink / raw)
  To: gdb-patches, binutils

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?
---
 configure    | 22 ++++++++++++++++++++++
 configure.ac | 18 ++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/configure b/configure
index be433ef6d5d..16139e3bfa3 100755
--- a/configure
+++ b/configure
@@ -790,6 +790,7 @@ enable_gold
 enable_ld
 enable_gprofng
 enable_compressed_debug_sections
+enable_year2038
 enable_libquadmath
 enable_libquadmath_support
 enable_libada
@@ -1520,6 +1521,7 @@ Optional Features:
   --enable-compressed-debug-sections={all,gas,gold,ld,none}
                           Enable compressed debug sections for gas, gold or ld
                           by default
+  --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
@@ -3127,6 +3129,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 :
@@ -7836,9 +7852,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 1651cbf3b02..a5555a9c91b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -440,6 +440,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],
@@ -3139,9 +3151,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])
-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2022-08-10 10:14 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01  7:51 [PATCH] Disable year 2038 support on 32-bit hosts by default Luis Machado
2022-08-01 14:08 ` Simon Marchi
2022-08-01 14:17   ` Luis Machado
2022-08-01 15:37     ` Simon Marchi
2022-08-01 15:58       ` Eli Zaretskii
2022-08-02  6:42         ` Luis Machado
2022-08-08 11:34           ` Luis Machado
2022-08-08 11:58             ` Eli Zaretskii
2022-08-08 12:04               ` Luis Machado
2022-08-08 12:38                 ` Eli Zaretskii
2022-08-08 17:55           ` Paul Eggert
2022-08-08 18:00             ` Luis Machado
2022-08-08 18:01               ` Luis Machado
2022-08-09 15:49                 ` Paul Eggert
2022-08-09 15:59                   ` Luis Machado
2022-08-09 16:13                     ` Paul Eggert
2022-08-10  9:41                     ` Nick Clifton
2022-08-10 10:14                       ` Luis Machado
2022-08-09 16:29                   ` Eli Zaretskii
2022-08-09 17:02                     ` Paul Eggert
2022-08-10  8:38                       ` Alan Modra
2022-08-08 14:51 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).