lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9176609.NChAu49t7f@wuerfel>
Date:	Thu, 15 May 2014 18:36:54 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	James Bottomley <James.Bottomley@...senpartnership.com>
Cc:	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Christoph Hellwig <hch@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ley Foon Tan <lftan@...era.com>,
	Linux-Arch <linux-arch@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	LeyFoon Tan <lftan.linux@...il.com>,
	Chung-Lin Tang <cltang@...esourcery.com>
Subject: Re: [PATCH 00/25] Change time_t and clock_t to 64 bit

On Thursday 15 May 2014 11:47:03 James Bottomley wrote:
> On Wed, 2014-05-14 at 13:00 +0200, Arnd Bergmann wrote:
> > On Tuesday 13 May 2014 22:35:08 Geert Uytterhoeven wrote:
> > > 
> > > On Tue, May 13, 2014 at 9:32 PM, Arnd Bergmann <arnd@...db.de> wrote:
> > > > I think we have three categories:
> > > 
> > > Thanks for the list!
> > > 
> > > > a) interfaces that uses relative time_t/timespec/timeval:
> > > > b) interfaces that don't make sense for times in the past:
> > > 
> > > > c) interfaces that require absolute times:
> > > >    - stat/lstat/fstatat/
> > > >    - utime/utimes/futimesat
> > > >
> > > > These absolutely have to use something better than time_t
> > > > both in user space and in the kernel so we can deal with
> > > > old files. A lot of file systems need to be fixed as well so
> > > > we can actually store the times, regardless of whether we
> > > > are running a 32 or 64 bit kernel.
> > > 
> > > So these are the ones we have to worry about.
> > > It looks like they all involve I/O? Apart from the case of using block data
> > > from the buffer cache, the 64-bit operations should disappear in the
> > > actual I/O noise, right?
> > 
> > Right. Also there have been proposals for a better 'stat' replacement
> > for years, which would solve half of the interface problem for the
> > file system interfaces.
> > 
> > However, we also need to find a solution for category b), I only put
> > them into a different category above because we can treat them
> > differently in the kernel. For instance, we could use ktime_t for
> > the kernel code in category b) and a new struct timespec64 for
> > the times in struct inode.
> > On the user interface side, using timespec64 would be a reasonable
> > choice for both categories, because we already have two implementations
> > of all those syscalls in order to handle 32-on-64 compat tasks,
> > and we could use the same set of syscall implementations for time64-on-32.
> 
> To step back a bit, is a 64 bit time_t actually a good solution on 32
> bits?  Paying a 64 bit penalty on every time operation does seem a bit
> overkill.  Most eventual uses are either monotonic counting or relative
> addition/subtraction.  If we added an additional 32 bit quantity called
> epoch, this would increase once every 68 years.  Within the kernel, we
> could do intelligent interpolation about what the epoch is, so in 2039
> if we get a low 32 bit time_t value, we assume epoch == 1, conversely if
> we see a high one, we assume epoch == 0.  We could add epoch on the end
> of the syscalls and detect if it's not present and fill in an
> interpolated value.  Interfaces which truly want 64 bit time_t would get
> it from epoch + 32 bit time_t.

The main advantage that I see with 64-bit time_t is that a lot of user
space already works with it, because NetBSD and OpenBSD use this, and
all 64-bit Linux systems already work with this without changing the ABI.
If we want a POSIX extension to cover a new ABI, this would be the most
likely candidate.

For Linux-only interfaces, the 64-bit nanosecond timestamps seem like
a good alternative, and they would also speed up the 64-bit architectures
because we can skip the normalization.

As mentioned earlier, between kernel and user space it's probably best
to avoid time_t and timeval completely and just use timespec64 or some
other safe type, but there has to be a way to port user space that relies
on time_t or timespec.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ