unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Andreas Schwab <schwab@suse.de>, "H.J. Lu" <hjl.tools@gmail.com>,
	Paul Eggert <eggert@cs.ucla.edu>
Cc: Florian Weimer <fweimer@redhat.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Stepan Golosunov <stepan@golosunov.pp.ru>,
	Alistair Francis <alistair.francis@wdc.com>,
	Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH] nptl: Handle NULL abstime [BZ #26394]
Date: Mon, 17 Aug 2020 15:30:19 +0200	[thread overview]
Message-ID: <20200817153019.6d86b10c@jawa> (raw)
In-Reply-To: <mvmft8lh8rr.fsf@suse.de>

[-- Attachment #1: Type: text/plain, Size: 3578 bytes --]

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" <hjl.tools@gmail.com>
> > 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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2020-08-17 13:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 10:22 [PATCH v5] y2038: nptl: Convert pthread_{clock|timed}join_np to support 64 bit time Lukasz Majewski
2020-08-12 21:54 ` Alistair Francis via Libc-alpha
2020-08-12 23:11 ` Adhemerval Zanella via Libc-alpha
2020-08-15 18:11 ` [PATCH] nptl: Handle NULL abstime [BZ #26394] H.J. Lu via Libc-alpha
2020-08-17 10:22   ` Andreas Schwab
2020-08-17 12:04     ` H.J. Lu via Libc-alpha
2020-08-17 13:30     ` Lukasz Majewski [this message]
2020-08-17 13:52       ` H.J. Lu via Libc-alpha
2020-08-17 13:58         ` Adhemerval Zanella via Libc-alpha
2020-08-17 14:24           ` Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200817153019.6d86b10c@jawa \
    --to=lukma@denx.de \
    --cc=alistair.francis@wdc.com \
    --cc=eggert@cs.ucla.edu \
    --cc=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    --cc=stepan@golosunov.pp.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).