glibc/sysdeps
Lukasz Majewski 63ff4a6d17 y2038: linux: Provide __clock_adjtime64 implementation
This patch replaces auto generated wrapper (as described in
sysdeps/unix/sysv/linux/syscalls.list) for clock_adjtime with one which adds
extra support for reading 64 bit time values on machines with __TIMESIZE != 64.

To achieve this goal new __clock_adjtime64 explicit 64 bit function for
adjusting Linux clock has been added.
Moreover, a 32 bit version - __clock_adjtime has been refactored to internally
use __clock_adjtime64.

The __clock_adjtime is now supposed to be used on systems still supporting 32
bit time (__TIMESIZE != 64) - hence the necessary conversions between 64 bit
struct __timespec64 and struct timespec.

The new __clock_adjtime64 syscall available from Linux 5.1+ has been used, when
applicable.
Up till v5.4 in the Linux kernel there was a bug preventing this call from
obtaining correct struct's timex time.tv_sec time after time_t overflow
(i.e. not being Y2038 safe).

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

Linux kernel, headers and minimal kernel version for glibc build test matrix:
- Linux v5.1 (with clock_adjtime64) and glibc build with v5.1 as
  minimal kernel version (--enable-kernel="5.1.0")
  The __ASSUME_TIME64_SYSCALLS flag defined.

- Linux v5.1 and default minimal kernel version
  The __ASSUME_TIME64_SYSCALLS not defined, but kernel supports clock_adjtime64
  syscall.

- Linux v4.19 (no clock_adjtime64 support) with default minimal kernel version
  for contemporary glibc (3.2.0)
  This kernel doesn't support clock_adjtime64 syscall, so the fallback to
  clock_adjtime is tested.

Above tests were performed with Y2038 redirection applied as well as without
(so the __TIMESIZE != 64 execution path is checked as well).

No regressions were observed.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2020-05-20 01:03:26 +02:00
..
aarch64 aarch64: fix strcpy and strnlen for big-endian [BZ #25824] 2020-05-15 12:15:56 +01:00
alpha Update alpha libm-test-ulps 2020-04-08 13:52:45 -03:00
arm arm: XFAIL string/tst-memmove-overflow due to bug 25620 2020-05-13 16:48:26 +02:00
csky semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
generic elf: Implement __libc_early_init 2020-04-24 22:32:09 +02:00
gnu Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
hppa semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
htl pthread: Move robust mutex tests from nptl to sysdeps/pthread 2020-02-16 14:43:54 +00:00
hurd C11 threads: Move implementation to sysdeps/pthread 2020-02-09 13:56:48 +01:00
i386 x86: Move CET control to _dl_x86_feature_control [BZ #25887] 2020-05-18 06:15:02 -07:00
ia64 semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
ieee754 float128: use builtin_signbitf128 always 2020-05-04 13:18:45 -05:00
m68k math: Remove inline math tests 2020-03-19 11:45:44 -03:00
mach Remove NO_CTORS_DTORS_SECTIONS macro 2020-05-18 15:39:34 +02:00
microblaze semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
mips Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 2020-04-30 08:52:08 -05:00
nios2 semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
nptl Linux: set_robust_list syscall number is always available 2020-03-03 12:49:44 +01:00
posix posix: Fix system error return value [BZ #25715] 2020-03-23 18:00:38 -03:00
powerpc powerpc: Optimized rawmemchr for POWER9 2020-05-18 17:08:54 -05:00
pthread pthread: Fix building tst-robust8 with nptl 2020-02-16 23:53:45 +01:00
riscv semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
s390 semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
sh semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
sparc semaphore: consolidate arch headers into a generic one 2020-05-06 13:07:12 -07:00
unix y2038: linux: Provide __clock_adjtime64 implementation 2020-05-20 01:03:26 +02:00
wordsize-32 Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
wordsize-64 Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
x86 x86: Add --enable-cet=permissive 2020-05-18 08:38:53 -07:00
x86_64 Linux: Remove remnants of the getcpu cache 2020-05-16 15:47:51 +02:00