glibc/sysdeps/unix/sysv/linux/x86
Lukasz Majewski 75c4044b9a y2038: linux: Provide __time64 implementation
In the glibc the time function can use vDSO (on power and x86 the
USE_IFUNC_TIME is defined), time syscall or 'default' time() from
./time/time.c (as a fallback).

In this patch the last function (time) has been refactored and moved
to ./sysdeps/unix/sysv/linux/time.c to be Linux specific.

The new __time64 explicit 64 bit function for providing 64 bit value of
seconds after epoch (by internally calling __clock_gettime64) has been
introduced.

Moreover, a 32 bit version - __time has been refactored to internally
use __time64.

The __time is now supposed to be used on systems still supporting 32 bit
time (__TIMESIZE != 64) - hence the necessary check for time_t potential
overflow.

The iFUNC vDSO direct call optimization has been removed from both i686 and
powerpc32 (USE_IFUNC_TIME is not defined for those architectures
anymore). The Linux kernel does not provide a y2038 safe implementation of
time neither it plans to provide it in the future, __clock_gettime64
should be used instead. Keeping support for this optimization would require
to handle another build permutation (!__ASSUME_TIME64_SYSCALLS &&
USE_IFUNC_TIME which adds more complexity and has limited use (since the
idea is to eventually have a y2038 safe glibc build).

Build tests:
./src/scripts/build-many-glibcs.py glibcs

Run-time tests:
- Run specific tests on ARM/x86 32bit systems (qemu):
https://github.com/lmajewski/meta-y2038 and run tests:
https://github.com/lmajewski/y2038-tests/commits/master

Above tests were performed with Y2038 redirection applied as well as
without to test proper usage of both __time64 and __time.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-10-19 16:01:37 +02:00
..
bits linux: Move the struct stat{64} to struct_stat.h 2020-10-09 17:02:06 -03:00
include/asm
sys
Implies
Makefile x86/CET: Update vfork to prevent child return 2020-10-15 04:00:36 -07:00
arch-pkey.h
cpu-features.c
dl-cet.h
dl-sysdep.c
elision-conf.c x86: Support usable check for all CPU features 2020-07-13 06:05:16 -07:00
elision-conf.h
elision-lock.c
elision-timed.c y2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bit 2020-10-15 09:35:43 +02:00
elision-trylock.c
elision-unlock.c
force-elision.h
gettimeofday.c
hle.h
jmp_buf-ssp.sym
lowlevellock.h y2038: nptl: Convert pthread_mutex_{clock|timed}lock to support 64 bit 2020-10-15 09:35:43 +02:00
pkey_get.c
pkey_set.c
pthread_mutex_cond_lock.c
pthread_mutex_lock.c
pthread_mutex_timedlock.c
pthread_mutex_trylock.c
setjmpP.h
sysconf.c
time.c y2038: linux: Provide __time64 implementation 2020-10-19 16:01:37 +02:00
tst-cet-property-1.c
tst-cet-property-2.c
tst-cet-property-dep-2.S
tst-cet-setcontext-1.c
tst-cet-vfork-1.c x86/CET: Update vfork to prevent child return 2020-10-15 04:00:36 -07:00
tst-saved_mask-1.c
xstatver.h Remove mknod wrapper functions, move them to symbols 2020-10-09 17:02:06 -03:00