Re: [PATCH 1/6] nptl: Treat negative times as timed out in PI futex locking (bug 34543)

Adhemerval Zanella Netto <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Organization Linaro
Message-ID <[email protected]>

On 19/08/26 16:34, Florian Weimer wrote:
> The non-PI case already does this:
> 
>   /* Work around the fact that the kernel rejects negative timeout
>      values despite them being valid.  */
>   if (__glibc_unlikely (abstime->tv_sec < 0))
>     return ETIMEDOUT;

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <[email protected]>

> ---
>  nptl/futex-internal.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/nptl/futex-internal.c b/nptl/futex-internal.c
> index 07f1462abe..59aef5daf6 100644
> --- a/nptl/futex-internal.c
> +++ b/nptl/futex-internal.c
> @@ -145,6 +145,11 @@ int
>  __futex_lock_pi64 (int *futex_word, clockid_t clockid,
>  		   const struct __timespec64 *abstime, int private)
>  {
> +  /* Work around the fact that the kernel rejects negative timeout values
> +     despite them being valid.  */
> +  if (__glibc_unlikely ((abstime != NULL) && (abstime->tv_sec < 0)))
> +    return ETIMEDOUT;
> +
>    int err;
>  
>    unsigned int clockbit = clockid == CLOCK_REALTIME
> 
> base-commit: a0faa928b094be829c52d1e493442ba3b48954b1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.