mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Revisiting 64-bit time_t
Date: Fri, 28 Jun 2019 11:06:59 -0400	[thread overview]
Message-ID: <20190628150659.GD1506@brightrain.aerifal.cx> (raw)

I've been thinking on and off a lot more about the time_t problem on
32-bit archs. My original idea for fixing this has always been to
introduce the ".2 ABI", fixing a lot of poorly chosen struct layouts,
etc. at the same time we make time_t 64-bit, but of course requiring
users/distros to make an active choice to switch over ABI at some
point, and not getting any benefit until then.

The idea has been that users (like embedded) who don't care
much/at-all about an ecosystem of ABI-compatible binaries, but build
everything from source with buildroot or yocto or whatever, would
switch right away so that their devices don't become Y2038 time bombs,
and desktop/server distros that receive constant updates could make
the transition at their leisure.

However Y2038 is not all that far off, desktop/server distros really
have rather little interest left in 32-bit archs (especially not
coordinating a costly ABI swap just for them), and some of the
extensibility improvements we'd get from a ".2 ABI" would be just as
desirable or more desirable on 64-bit archs, which don't even have the
time_t motivation to do it now.

So I'm thinking more and more about doing a different fix. In a way
it's like how glibc did 64-bit off_t, and how they're doing 64-bit
time_t, except it wouldn't be switchable and wouldn't default to the
old behavior; once we pull the lever, everything would be built with
64-bit time_t. This would work via symbol redirction in the headers
for the affected functions (probably via a bits header for the 32-bit
archs), which is valid because, by virtue of using time_t or a derived
type, the standard requires that you include the headers to get the
declaration rather than declaring the function yourself.

Doing it this way does not break application-to-libc ABI, because the
old symbols still exist; they're just not used for linking new
programs. It does however impact ABI between libraries outside libc if
they use time_t or any of the derived types (timespec, stat, ...) in
their public (not internal, only public) APIs. How big that impact
would be is an open question; it might mean this approach would
require some coordinated updating of affected libraries and
applications using them in sync to prevent breakage.

Aside from community feedback, what's needed to make this possible, if
it's going to happen, is some good analysis of the scope of breakage.
Such analysis would also benefit glibc -- it would help determine how
safe their _TIME_BITS=64 option will be and whether it can be turned
on safely by default in the presence of old libraries built without
it. I've already discussed this casually with a few people and it
looks like the right starting point would be getting a Debian system
(Debian because their repo is utterly huge) with ALL library packages
installed and grepping /usr/include for all headers that involve
time_t or any of the derived types. Then, manual analysis would need
to be done to determine whether the usage actually has an impact.

If there are a significant number of affected libraries and we want to
go forward with something like this anyway, there should probably be
an optional patch distros can use to make ldso refuse to load certain
tagged .so files into a process where any of the 64-bit time symbols
have been referenced. This would ensure transitioning users get an
error message rather than silent misexecution.

Rich


             reply	other threads:[~2019-06-28 15:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 15:06 Rich Felker [this message]
2019-06-29  8:36 ` A. Wilcox
2019-06-29 16:21   ` Rich Felker
2019-07-01 14:41     ` Arnd Bergmann
2019-07-01 14:50       ` A. Wilcox
2019-07-01 15:41         ` Rich Felker
2019-07-01 15:55           ` A. Wilcox
2019-07-01 15:57       ` Florian Weimer
2019-07-01 16:07       ` Rich Felker
2019-07-02  9:35         ` Arnd Bergmann
2019-07-02 21:09           ` Rich Felker
2019-06-29 16:35 ` Rich Felker
2019-07-01 14:42 ` Arnd Bergmann
2019-07-01 15:31   ` Rich Felker
2019-07-01 21:12     ` Arnd Bergmann
2019-07-01 22:07       ` Rich Felker
2019-07-02  8:28         ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190628150659.GD1506@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).