[v7,0/5] Always use 32-bit time_t for certain syscalls

Message ID 20200331154656.687841-1-alistair.francis@wdc.com
Headers show
Series
  • Always use 32-bit time_t for certain syscalls
Related show

Message

H.J. Lu via Libc-alpha March 31, 2020, 3:46 p.m.
On y2038 safe 32-bit systems the Linux kernel expects itimerval
and rusage to use a 32-bit time_t, even though the other time_t's
are 64-bit.

This series converts getitimer, setitimer, getrusage and wait4 to be
both y2038 safe and pass a 32-bit time_t based on the
__KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 macro. On 32-bit systems
we will pass a 32-bit time to the kernel (no matter the time_t size). This is
no change for most 64-bit architectures or 32-bit architectures with a 32-bit time_t.

We can also remove the old Alpha functions as this is now handled genericly.

This follows the standard y2038 conversion so that we don't break
backwards compatibility but we expose a 64-bit version for y2038 safe
architectrures (like RV32).

This series was tested by running:
  ./scripts/build-many-glibcs.py ... compilers
  ./scripts/build-many-glibcs.py ... glibcs
on my x86_64 machine.

I also ran make check on RV32 and I only see a total of 10 test failures.

I don't have a way to test this on Alpha, would someone mind testing it for me?

v7:
 - Fix the lack of setting for getitimer
v6:
 - Rebase on master
 - Address v5 review comments
v5:
 - Rebase on master

Alistair Francis (5):
  sysv: Define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64
  linux: Use long time_t __getitimer/__setitimer
  resource: Add a __rusage64 struct
  linux: Use long time_t for wait4/getrusage
  sysv/alpha: Use generic __timeval32 and helpers

 bits/typesizes.h                              |   6 +
 include/sys/resource.h                        | 121 ++++++++++++++++++
 include/time.h                                |  15 +++
 sysdeps/unix/syscalls.list                    |   3 -
 .../unix/sysv/linux/alpha/bits/typesizes.h    |   3 +
 sysdeps/unix/sysv/linux/alpha/osf_adjtime.c   |  15 ++-
 sysdeps/unix/sysv/linux/alpha/osf_getitimer.c |   9 +-
 sysdeps/unix/sysv/linux/alpha/osf_getrusage.c |  10 +-
 .../unix/sysv/linux/alpha/osf_gettimeofday.c  |   6 +-
 sysdeps/unix/sysv/linux/alpha/osf_setitimer.c |  15 ++-
 .../unix/sysv/linux/alpha/osf_settimeofday.c  |   6 +-
 sysdeps/unix/sysv/linux/alpha/osf_utimes.c    |   8 +-
 sysdeps/unix/sysv/linux/alpha/osf_wait4.c     |  10 +-
 .../unix/sysv/linux/generic/bits/typesizes.h  |   6 +
 sysdeps/unix/sysv/linux/getitimer.c           |  61 +++++++++
 sysdeps/unix/sysv/linux/getrusage.c           |  58 +++++++++
 sysdeps/unix/sysv/linux/s390/bits/typesizes.h |   6 +
 sysdeps/unix/sysv/linux/setitimer.c           |  94 ++++++++++++++
 .../unix/sysv/linux/sparc/bits/typesizes.h    |   6 +
 .../alpha-tv32-compat.h => tv32-compat.h}     |  94 ++++++--------
 sysdeps/unix/sysv/linux/wait4.c               |  50 +++++++-
 sysdeps/unix/sysv/linux/x86/bits/typesizes.h  |   5 +
 22 files changed, 507 insertions(+), 100 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/getitimer.c
 create mode 100644 sysdeps/unix/sysv/linux/getrusage.c
 create mode 100644 sysdeps/unix/sysv/linux/setitimer.c
 rename sysdeps/unix/sysv/linux/{alpha/alpha-tv32-compat.h => tv32-compat.h} (53%)

-- 
2.26.0