Hi Andreas, H.J., > On Aug 15 2020, H.J. Lu wrote: > > > From fa1f97680fca290a378c449f2b63682ee348fd2c Mon Sep 17 00:00:00 > > 2001 From: "H.J. Lu" > > Date: Sat, 15 Aug 2020 11:06:35 -0700 > > Subject: [PATCH] nptl: Handle NULL abstime [BZ #26394] > > > > Since abstime passed to pthread_{clock|timed}join_np may be NULL, Could you point me to the exact reference that it is allowed (or required) to pass NULL to this syscall? The one which I've found on the web: https://linux.die.net/man/3/pthread_timedjoin_np doesn't mention about NULL pointer passed as the absolute time. It says explicitly: "The abstime argument is a structure of the following form, specifying an absolute time measured since the Epoch" As fair as I remember [1] glibc only handles the NULL pointer case when it is explicitly written in the documentation/spec that NULL is passed (like here: https://linux.die.net/man/2/timerfd_settime or here: https://linux.die.net/man/2/utimensat). Link: [1] - https://sourceware.org/pipermail/libc-alpha/2019-November/108072.html > > convert to 64 bit abstime only if abstime isn't NULL. > > --- > > nptl/pthread_clockjoin.c | 12 +++++++++--- > > nptl/pthread_timedjoin.c | 10 +++++++--- > > 2 files changed, 16 insertions(+), 6 deletions(-) > > > > diff --git a/nptl/pthread_clockjoin.c b/nptl/pthread_clockjoin.c > > index 3cd780f688..0d780d6f4b 100644 > > --- a/nptl/pthread_clockjoin.c > > +++ b/nptl/pthread_clockjoin.c > > @@ -34,9 +34,15 @@ int > > __pthread_clockjoin_np (pthread_t threadid, void **thread_return, > > clockid_t clockid, const struct timespec > > *abstime) { > > - struct __timespec64 ts64 = valid_timespec_to_timespec64 > > (*abstime); - > > - return __pthread_clockjoin_np64 (threadid, thread_return, > > clockid, &ts64); > > + if (abstime) > > (abstime != NULL) > > > + { > > + struct __timespec64 ts64 = valid_timespec_to_timespec64 > > (*abstime); > > + return __pthread_clockjoin_np64 (threadid, thread_return, > > clockid, > > + &ts64); > > + } > > + else > > + return __pthread_clockjoin_np64 (threadid, thread_return, > > clockid, > > + NULL); > > } > > #endif > > weak_alias (__pthread_clockjoin_np, pthread_clockjoin_np) > > diff --git a/nptl/pthread_timedjoin.c b/nptl/pthread_timedjoin.c > > index 6164ae7060..a7b3cb35d2 100644 > > --- a/nptl/pthread_timedjoin.c > > +++ b/nptl/pthread_timedjoin.c > > @@ -34,9 +34,13 @@ int > > __pthread_timedjoin_np (pthread_t threadid, void **thread_return, > > const struct timespec *abstime) > > { > > - struct __timespec64 ts64 = valid_timespec_to_timespec64 > > (*abstime); - > > - return __pthread_timedjoin_np64 (threadid, thread_return, &ts64); > > + if (abstime) > > (abstime != NULL) > > > + { > > + struct __timespec64 ts64 = valid_timespec_to_timespec64 > > (*abstime); > > + return __pthread_timedjoin_np64 (threadid, thread_return, > > &ts64); > > + } > > + else > > + return __pthread_timedjoin_np64 (threadid, thread_return, > > NULL); } > > #endif > > weak_alias (__pthread_timedjoin_np, pthread_timedjoin_np) > > Andreas. > Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de