y2038: nptl: Convert pthread_{clock|timed}join_np to support 64 bit time

System Internals / glibc - Lukasz Majewski [denx.de] - 13 August 2020 12:16 UTC

The pthread_clockjoin_np and pthread_timedjoin_np have been converted to support 64 bit time.

This change introduces new futex_timed_wait_cancel64 function in ./sysdeps/nptl/futex-internal.h, which uses futex_time64 where possible and tries to replace low-level preprocessor macros from lowlevellock-futex.h The pthread_{timed|clock}join_np only accept absolute time. Moreover, there is no need to check for NULL passed as *abstime pointer as clockwait_tid() always passes struct __timespec64.

For systems with __TIMESIZE != 64 && __WORDSIZE == 32:- Conversions between 64 bit time to 32 bit are necessary- Redirection to __pthread_{clock|timed}join_np64 will provide support for 64 bit time

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 the proper usage of both __pthread_{timed|clock}join_np64 and __pthread_{timed|clock}join_np.

4a14cb87ca y2038: nptl: Convert pthread_{clock|timed}join_np to support 64 bit time
nptl/pthreadP.h | 16 ++++++++++++-
nptl/pthread_clockjoin.c | 19 +++++++++++++---
nptl/pthread_join_common.c | 19 +++++++++-------
nptl/pthread_timedjoin.c | 18 +++++++++++++--
sysdeps/nptl/futex-internal.h | 52 +++++++++++++++++++++++++++++++++++++++++++
5 files changed, 110 insertions(+), 14 deletions(-)

Upstream: sourceware.org


  • Share