glibc/include
Lukasz Majewski 7ce198e123 y2038: linux: Provide __clock_settime64 implementation
This patch provides new __clock_settime64 explicit 64 bit function for
setting the time. Moreover, a 32 bit version - __clock_settime - has been
refactored to internally use __clock_settime64.

The __clock_settime is now supposed to be used on systems still supporting
32 bit time (__TIMESIZE != 64) - hence the necessary conversion to 64 bit
struct timespec.

The new clock_settime64 syscall available from Linux 5.1+ has been used,
when applicable.

In this patch the internal padding (tv_pad) of struct __timespec64 is
left untouched (on systems with __WORDSIZE == 32) as Linux kernel ignores
upper 32 bits of tv_nsec.

Build tests:
- The code has been tested on x86_64/x86 (native compilation):
make PARALLELMFLAGS="-j8" && make xcheck PARALLELMFLAGS="-j8"

- The glibc has been build tested (make PARALLELMFLAGS="-j8") for
x86 (i386), x86_64-x32, and armv7

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

- Use of cross-test-ssh.sh for ARM (armv7):
  make PARALLELMFLAGS="-j8" test-wrapper='./cross-test-ssh.sh root@192.168.7.2' xcheck

Linux kernel, headers and minimal kernel version for glibc build test
matrix:
- Linux v5.1 (with clock_settime64) 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_settime64 syscalls.

- Linux v4.19 (no clock_settime64 support) with default minimal kernel
  version for contemporary glibc

  This kernel doesn't support __clock_settime64 syscalls, so the fallback
  to clock_settime is tested.

The 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.

* include/time.h (__clock_settime64):
  Add __clock_settime alias according to __TIMESIZE define
* sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime):
  Refactor this function to be used only on 32 bit machines as a wrapper
  on __clock_settime64.
* sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime64): Add
* sysdeps/unix/sysv/linux/clock_settime.c (__clock_settime64):
  Use clock_settime64 kernel syscall (available from 5.1+ Linux)
2019-10-10 00:17:46 +02:00
..
arpa CVE-2016-10739: getaddrinfo: Fully parse IPv4 address strings [BZ #20018] 2019-01-21 21:26:03 +01:00
bits Split up endian.h to minimize exposure of BYTE_ORDER. 2019-10-01 14:54:46 -07:00
gnu Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
net
netinet Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
programs Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
protocols
rpc Run thread shutdown functions in an explicit order 2018-06-26 15:27:12 +02:00
rpcsvc Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
sys Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
aio.h
aliases.h
alloc_buffer.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
alloca.h Remove macros extend_alloca, extend_alloca_account [BZ #18023] 2018-06-27 19:20:37 +02:00
allocate_once.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
ar.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
argp-fmtstream.h
argp.h ldbl-opt: Add argp_error and argp_failure (bug 23983) 2019-03-01 15:21:32 -03:00
argz.h Use libc_hidden_* for argz_next, __argz_next (bug 15105). 2018-02-15 21:00:02 +00:00
array_length.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
assert.h Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN 2017-10-03 01:33:38 +02:00
atomic.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
byteswap.h
complex.h
cpio.h
crypt.h
ctype.h Use libc_hidden_* for tolower, toupper (bug 15105). 2018-02-23 13:54:53 +00:00
des.h
dirent.h <dirent.h>: Remove wrong comment about getdents64 declaration 2019-10-09 11:31:03 +02:00
dlfcn.h libc: Extend __libc_freeres framework (Bug 23329). 2018-06-29 22:39:06 -04:00
dso_handle.h
elf.h elf: Refuse to dlopen PIE objects [BZ #24323] 2019-06-18 16:42:10 +02:00
endian.h
envz.h
err.h ldbl-opt: Add err, errx, verr, verrx, warn, warnx, vwarn, and vwarnx (bug 23984) 2019-03-01 15:24:51 -03:00
errno.h hurd: Fix accessing errno from rtld 2018-03-25 00:48:01 +01:00
error.h ldbl-opt: Add error and error_at_line (bug 23984) 2019-03-01 15:26:36 -03:00
execinfo.h
fcntl.h Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) 2018-06-26 13:22:53 -03:00
features.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
fenv.h Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
float.h Make totalorder and totalordermag functions take pointer arguments. 2019-08-15 15:18:34 +00:00
fmtmsg.h
fnmatch.h
fpu_control.h
fstab.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
fts.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
ftw.h
gconv.h
getopt_int.h
getopt.h
glob.h
gmp.h
gnu-versions.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
grp-merge.h
grp.h
gshadow.h
iconv.h
ifaddrs.h
ifreq.h
ifunc-impl-list.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
inline-hashtab.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
intprops.h Update copyright dates with scripts/update-copyrights. 2019-01-01 00:11:28 +00:00
inttypes.h Move inttypes.h and stdint.h to stdlib. 2019-03-13 09:42:09 -04:00
langinfo.h
lastlog.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
libc-diag.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
libc-internal.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
libc-pointer-arith.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
libc-symbols.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
libgen.h
libintl.h
limits.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
link.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
list_t.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
list.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
locale.h
loop_unroll.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
malloc.h Don't declare __malloc_check_init in <malloc.h> (bug 23352) 2019-07-10 15:04:05 +02:00
math-narrow-eval.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
math.h Use copysign functions not __copysign functions in glibc libm. 2018-09-27 20:04:48 +00:00
mcheck.h
memory.h
mntent.h
monetary.h Use STRFMON_LDBL_IS_DBL instead of __ldbl_is_dbl. 2018-11-16 09:21:14 -02:00
mqueue.h
netdb.h
netgroup.h
nl_types.h
nss.h nss: Export nscd hash function as __nss_hash [BZ #22459] 2017-11-23 14:08:11 +01:00
nsswitch.h
obstack.h
plural-exp.h
poll.h
printf.h
pthread.h
pty.h
pwd.h
random-bits.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
re_comp.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
regex.h
regexp.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
resolv.h Obsolete p_secstodate. 2017-11-22 22:21:10 +00:00
rounding-mode.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
sched.h Don't use __typeof__ (getcpu) 2018-12-07 12:47:41 -08:00
scratch_buffer.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
search.h misc: Add twalk_r function 2019-05-02 11:42:51 +02:00
set-hooks.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
setjmp.h Make totalorder and totalordermag functions take pointer arguments. 2019-08-15 15:18:34 +00:00
sgtty.h
shadow.h
shlib-compat.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
signal.h Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN 2017-10-03 01:33:38 +02:00
spawn.h posix: Use posix_spawn for wordexp 2019-10-09 17:48:41 -03:00
stab.h
stackinfo.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
stap-probe.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
stdc-predef.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
stdint.h Move inttypes.h and stdint.h to stdlib. 2019-03-13 09:42:09 -04:00
stdio_ext.h
stdio.h Do not print backtraces on fatal glibc errors 2019-08-19 15:41:29 +02:00
stdlib.h Use libc_hidden_* for atoi (bug 15105). 2018-02-26 18:17:47 +00:00
string.h Run thread shutdown functions in an explicit order 2018-06-26 15:27:12 +02:00
strings.h
stubs-prologue.h
syscall.h
sysexits.h
syslog.h
tar.h
termios.h
tgmath.h
time.h y2038: linux: Provide __clock_settime64 implementation 2019-10-10 00:17:46 +02:00
ttyent.h
uchar.h
ucontext.h
ulimit.h
unistd.h hurd: Fix linknamespace of spawni 2018-12-07 20:21:45 +01:00
utime.h
utmp.h
values.h Prefer https to http for gnu.org and fsf.org URLs 2019-09-07 02:43:31 -07:00
verify.h Merge mktime, timegm from upstream Gnulib 2018-09-19 17:09:08 -07:00
wait.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
wchar.h wcsmbs: optimize wcscat 2019-02-27 10:00:37 -03:00
wctype.h
wordexp.h