|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A new build flag, _TIME_BITS, enables the usage of the newer 64 bit
time symbols for legacy ABI (where 32 bit time_t is default). The 64
bit time support is only enabled if LFS (_FILE_OFFSET_BITS=64) is
also used.
Different than LFS support, the y2038 symbols are added only for the
required ABIs (armhf, csky, hppa, i386, m68k, microblaze, mips32,
nios2, powerpc32, sparc32, s390-32, and sh). The ABIs with 64 bit
time support are unchanged, both for symbol and types redirection.
On Linux apropoer 64 bit time support requires a minimum of kernel
version v5.1. Otherwise, the 32 bit fallbacks are used and might
results in error with overflow return code (EOVERFLOW).
The i686-gnu does not yet support 64 bit time, and trying to build
it using -D_TIME_BITS=64 results in an error.
This patch also converts following implemetations to support 64 bit
time:
* libc:
- adjtimex
- adjtime
- clock_adjtime
- clock_getres
- clock_gettime
- clock_nanosleep_time
- clock_settime
- ctime
- ctime_r
- difftime
- futimens
- futimes
- futimesat
- getitimer
- getrusage
- gettimeofday
- gmtime
- gmtime
- lutimes
- mktime
- msgctl
- nanosleep
- ntp_gettime
- ntp_gettimex
- ppoll
- pselect
- recvmmsg
- sched_rr_get_interval
- select
- semctl
- semtimedop
- setitimer
- settimeofday
- shmctl
- sigtimedwait
- time
- timegm
- timerfd_gettime
- timerfd_settime
- timespec_get
- utime
- utimensat
- utimes
- wait3
- wait4
* libpthread:
- mtx_timedlock
- pthread_clockjoin_np
- pthread_cond_clockwait
- pthread_cond_timedwait
- pthread_mutex_clocklock
- pthread_mutex_timedlock
- pthread_rwlock_clockrdlock
- pthread_rwlock_clockwrlock
- pthread_rwlock_timedrdlock
- pthread_rwlock_timedwrlock
- pthread_timedjoin_np
- sem_clockwait
- sem_timedwait
* librt:
- aio_suspend_time
- mq_timedreceive_time
- mq_timedsend_time
- timer_gettime
- timer_settime
* libanl:
- gai_suspend
|
|
To provide a y2038 safe interface a new symbol __shmctl64 is added
and __shmctl is change to call it instead (it adds some extra buffer
copying for the 32 bit time_t implementation).
Two new structures are added:
1. kernel_shmid64_ds: used internally only on 32-bit architectures
to issue the syscall. A handful of architectures (hppa, i386,
mips, powerpc32, and sparc32) require specific implementations
due to their kernel ABI.
2. shmid_ds64: this is only for __TIMESIZE != 64 to use along with
the 64-bit shmctl. It is different than the kernel struct because
the exported 64-bit time_t might require different alignment
depending on the architecture ABI.
So the resulting implementation does:
1. For 64-bit architectures it assumes shmid_ds already contains
64-bit time_t fields and will result in just the __shmctl symbol
using the __shmctl64 code. The shmid_ds argument is passed as-is
to the syscall.
2. For 32-bit architectures with default 64-bit time_t (newer ABIs
such riscv32 or arc), it will also result in only one exported
symbol but with the required high/low time handling.
3. Finally for 32-bit architecture with both 32-bit and 64-bit time_t
support we follow the already set way to provide one symbol with
64-bit time_t support and implement the 32-bit time_t support
using of the 64-bit one.
The default 32-bit symbol will allocate and copy the shmid_ds
over multiple buffers, but this should be deprecated in favor
of the __shmctl64 anyway.
Checked on i686-linux-gnu and x86_64-linux-gnu. I also did some sniff
tests on powerpc, powerpc64, mips, mips64, armhf, sparcv9, and
sparc64.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|