linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Albert ARIBAUD <albert.aribaud@3adev.fr>,
	GNU C Library <libc-alpha@sourceware.org>,
	Firoz Khan <firoz.khan@linaro.org>,
	Linux API <linux-api@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH] Y2038: provide kernel support indication
Date: Wed, 5 Dec 2018 15:26:14 +0100	[thread overview]
Message-ID: <CAK8P3a25W8NXY9e=DMzL-jd4+69ecZMyrWGxYDPP4MuH-Ng-9Q@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1812051337210.13925@digraph.polyomino.org.uk>

On Wed, Dec 5, 2018 at 2:48 PM Joseph Myers <joseph@codesourcery.com> wrote:
> On Wed, 5 Dec 2018, Arnd Bergmann wrote:
>
> > I think it's important that we only do this when we are called from
> > an application with 64-bit time_t: When a user calls gettimeofday()
> > with 64-bit time_t, that should try clock_gettime64(2) and fall back
> > to clock_gettime(2) or gettimeofday(2) if that is unavailable. However
> > an application using gettimeofday() with a 32-bit time_t should
> > directly call gettimeofday(2) in the kernel but not try clock_gettime64()
> > first. Without that distinction, the kernel cannot return -ENOSYS
> > if we configure it to break compatibility with 32-bit time_t interfaces
> > and the application might seem to work correctly despite being
> > broken in 2038.
>
> By design, all nontrivial 32-bit time interfaces in glibc for 32-bit
> architectures should end up as simple wrappers round the implementations
> using 64-bit time internally, to avoid duplication of complicated code
> (previous versions of the Y2038 patches e.g. duplicated hundreds of lines
> of pthread_mutex_timedlock implementation, which is clearly not a
> maintainable approach).  That means many 32-bit interfaces *will* end up
> using 64-bit syscalls (with fallback to 32-bit if the 64-bit syscalls are
> unavailable at runtime), even if some simple functions that really are
> just one syscall for 32-bit still call the old syscall.

That would make it very hard to deploy a glibc based system
with strict y2038 requirements. If we can no longer guarantee the
basic assumption that old applications keep using the old system
calls, then I think we instead need a way to build glibc itself without
support for the 32-bit time_t interfaces, e.g. using a --disable-time32
configuration switch to force a link-time error for any application
or library that has not been built against the 64-bit time_t interfaces.

The default would of course remain providing backwards compatibility
with all applications to allow a gradual migration from 32-bit time_t
to 64-bit time_t. If all 32-bit time_t calls are just wrappers around
either the internal implementation using 64-bit time_t or around
a simple system call, then it should at least be easy to make them
optional for users that need them not work.

Would that be something you can do?

      Arnd

  reply	other threads:[~2018-12-05 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180919071303.26636-1-albert.aribaud@3adev.fr>
     [not found] ` <alpine.DEB.2.21.1809191300420.14910@digraph.polyomino.org.uk>
     [not found]   ` <20180924235639.716a4cb4@athena>
     [not found]     ` <alpine.DEB.2.21.1809251656190.14070@digraph.polyomino.org.uk>
     [not found]       ` <20180925213635.70084f61@athena>
     [not found]         ` <CAK8P3a17ZpOKx=p1Y2FgruM3GMcdOtiwaQqPvmg5xZQpFP2fCQ@mail.gmail.com>
     [not found]           ` <20181205124926.7d433994@athena>
2018-12-05 13:33             ` [PATCH] Y2038: provide kernel support indication Arnd Bergmann
2018-12-05 13:48               ` Joseph Myers
2018-12-05 14:26                 ` Arnd Bergmann [this message]
2018-12-05 15:26                   ` Joseph Myers

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='CAK8P3a25W8NXY9e=DMzL-jd4+69ecZMyrWGxYDPP4MuH-Ng-9Q@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=albert.aribaud@3adev.fr \
    --cc=firoz.khan@linaro.org \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=luto@kernel.org \
    /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.
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).