ksummit.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: ksummit-discuss@lists.linuxfoundation.org
Subject: [Ksummit-discuss] Leap second handling
Date: Tue, 15 Dec 2015 11:33:58 +0000	[thread overview]
Message-ID: <10141.1450179238@warthog.procyon.org.uk> (raw)

I know it's a bit late for the KS, but should we alter the interpretation of
the time-as-seconds-since-1970 in the kernel to include leap seconds?

The reason I ask is that we have to deal with X.509 certificates in the kernel,
and the certificate can have dates encoded using GeneralizedTime ASN.1 objects.
These are formatted as per ISO 8601.  ISO 8601 encodes leap seconds as hh:mm:60
- so it's possible that I can see this in cert I have to deal with, and as such
I must permit it.  I turn the date and time components into a time64_t with
mktime64() - but that doesn't know about leap seconds, however.

So the question is how to deal with it.  I can see three obvious ways:

 (1) Treat it the same as hh:mm:59.

 (2) Treat it the same as hh:mm+1:00, rolling over the carry through to the
     year if necessary.

 (3) Assign specific time_t values to leap seconds in mktime64().  There's a
     table of them here:

	https://en.wikipedia.org/wiki/Leap_second

     It wouldn't be hard to do within just the kernel, but this would put the
     kernel at odds with userspace to the tune of nearly half a minute at the
     current time.  It might be sufficient to just fix the libc's in userspace
     - but you can bet there's someone somewhere who checks that seconds
     doesn't exceed 59.

     The kernel would also need to tell libc whether or not the time value it
     gets includes leap seconds.

Any thoughts?

David

             reply	other threads:[~2015-12-15 11:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 11:33 David Howells [this message]
2015-12-15 12:12 ` Arnd Bergmann
2015-12-15 14:15   ` Alexandre Belloni
2015-12-16  5:12     ` John Stultz
2015-12-17  0:32     ` David Howells
2015-12-17  0:44       ` John Stultz

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=10141.1450179238@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=ksummit-discuss@lists.linuxfoundation.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