Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339668

Re: [PATCH] rtc: Add an option to invalidate dates in 2038

From Alexandre Belloni <alexandre.belloni@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH] rtc: Add an option to invalidate dates in 2038
Date 2016-02-22 17:00 +0100
Message-ID <r513X-7RT-1@gated-at.bofh.it> (permalink)
References <r4leq-23T-1@gated-at.bofh.it> <r4Ypt-6jn-43@gated-at.bofh.it> <r4Z2b-6yP-35@gated-at.bofh.it> <r50Ui-7Ny-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 22/02/2016 at 16:44:32 +0100, Arnd Bergmann wrote :
> On Monday 22 February 2016 13:43:19 One Thousand Gnomes wrote:
> > On Mon, 22 Feb 2016 14:00:14 +0100
> > Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
> > > I can also agree that systemd could be a bit more robust there but
> > > you'll have to convince Lennart...
> > 
> > That's a systemd problem. If their code isn't robust then the
> > distributiosn will just have to keep patching it.
> > 
> > The only problem that can actually be "fixed" is the case where it isn't
> > 2038 yet and the user has a scrambled RTC. In that case your init tools
> > need to be robust enough to handle the problem or use APIs that don't
> > break. The kernel can't actually "fix" this because it never knows
> > whether your userspace is sane or not.
> > 
> > I'd argue btw that any code using timerfd_create with TFD_TIMER_ABSTIME
> > and passing it a value that wraps the range permitted by that time
> > representation *is* buggy. It's the applications responsibility to use
> > values that are within the defined behavioural range of the function.
> 
> IIRC, the problem is that user space passes in TIME_T_MAX and the kernel
> is considering that to be in the past because the clock is set beyond 2038.
> 
> I find it hard to blame user space for that, but I don't have a good
> idea for solving this either.
> 
> In case of systemd, it is literally the first thing that runs on the kernel
> after booting, so we could fall back to setting the time to some known
> working state (1970 or 2016 or something), but that would be a rather
> bad default policy once the system has been running for a while.
> 

Also, how would you know that it is an invalid time, some RTC doesn't
provide that information. One other workaround is to asked distributions
using systemd to stop using HCTOSYS so userspace would be responsible to
set the system time and in that case we won't have the 32/64 discrepancy.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] rtc: Add an option to invalidate dates in 2038 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-20 20:20 +0100
  Re: [PATCH] rtc: Add an option to invalidate dates in 2038 One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-02-20 20:50 +0100
    Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-20 21:50 +0100
      Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Arnd Bergmann <arnd@arndb.de> - 2016-02-20 23:20 +0100
        Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-21 00:20 +0100
          Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-21 00:50 +0100
          Re: [PATCH] rtc: Add an option to invalidate dates in 2038 One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-02-21 18:30 +0100
            Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-22 14:10 +0100
              Re: [PATCH] rtc: Add an option to invalidate dates in 2038 One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-02-22 14:50 +0100
                Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Arnd Bergmann <arnd@arndb.de> - 2016-02-22 16:50 +0100
                Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-22 17:00 +0100
                Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Arnd Bergmann <arnd@arndb.de> - 2016-02-22 17:20 +0100
                Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-22 17:50 +0100
                Re: [PATCH] rtc: Add an option to invalidate dates in 2038 "Austin S. Hemmelgarn" <ahferroin7@gmail.com> - 2016-02-22 17:50 +0100
                Re: [PATCH] rtc: Add an option to invalidate dates in 2038 Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-02-22 18:10 +0100

csiph-web