From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A8B801F66E for ; Mon, 17 Aug 2020 12:04:53 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C442B3857C47; Mon, 17 Aug 2020 12:04:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C442B3857C47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1597665891; bh=RKrYyRrEhn2ZJnPCwKtkYhtXzqrI/P3UcJ9vxUpIaHU=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ueaxHX26EW/vC1PXoM6AxrHUxXz+AOre99525kn+xVp6yblbfc1qLZwE36zFN3aZM 2/G86R3KFWvqRjtqZ8E62SG4vW2kltBdsSZJOCTqT+HAjDS2ZbUQnBw6XH/6f+Ru60 xeVLlwm7q9DGCQBsn+kj5Gs/qL3mI+FF6voz6lYo= Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by sourceware.org (Postfix) with ESMTPS id 56E503857C47 for ; Mon, 17 Aug 2020 12:04:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 56E503857C47 Received: by mail-pj1-x1043.google.com with SMTP id ep8so7596024pjb.3 for ; Mon, 17 Aug 2020 05:04:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RKrYyRrEhn2ZJnPCwKtkYhtXzqrI/P3UcJ9vxUpIaHU=; b=kpWQUhKMepgD7uo4KGBIbx/wZw65YVWVBWK6OPuwGtrGh4bmsZo0i4VwYuwjcGITMe 7uDmPu0Fi+6yQWtRNSyT3PGeamA9d4yBJjPJjSL5bqEw80LPLpmV4tLGKpYY3uqAi4Xe q9ahQNVEwNYAtJowjnJrEqanhYABp/SetI6mDZBF5aLAAtCb4XLZjxrMf5zSFXMYzJmE QZYIF4N4eC5XmLP+ppKy2IJD6J5nD2qm8U414am2lMexMvGPAICS06pPaUhFui8/23FW h7hGZf7FpzQhrxdMu6jBICLQuepore/3eqERO/IuYxRQIsMQ7VINZaRq27JFjHoS+qHt hhnw== X-Gm-Message-State: AOAM531Lj/7i8VoqaSWj5EsVQ6+vvgemlhI8eXg9gQUxsPw7sYbplVOD rVt5KQ/7zlPCAOcoe98HiFWXl6Y+xZuJWg== X-Google-Smtp-Source: ABdhPJy628VKZFp5dizB3K1/1OzIB78qAWgTBI27znh5WkR/WJItDUV8VJlgFi4jOLcJ9+jtrWGanw== X-Received: by 2002:a17:902:ba8f:: with SMTP id k15mr11259404pls.79.1597665888432; Mon, 17 Aug 2020 05:04:48 -0700 (PDT) Received: from gnu-cfl-2.localdomain (c-69-181-90-243.hsd1.ca.comcast.net. [69.181.90.243]) by smtp.gmail.com with ESMTPSA id v10sm19432432pff.192.2020.08.17.05.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 05:04:47 -0700 (PDT) Received: by gnu-cfl-2.localdomain (Postfix, from userid 1000) id 6F0ED1A0221; Mon, 17 Aug 2020 05:04:46 -0700 (PDT) Date: Mon, 17 Aug 2020 05:04:46 -0700 To: Andreas Schwab Subject: Re: [PATCH] nptl: Handle NULL abstime [BZ #26394] Message-ID: <20200817120446.GA2418158@gmail.com> References: <20200812102205.14816-1-lukma@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "H.J. Lu via Libc-alpha" Reply-To: "H.J. Lu" Cc: Florian Weimer , GNU C Library , Stepan Golosunov , Alistair Francis , Joseph Myers Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On Mon, Aug 17, 2020 at 12:22:16PM +0200, Andreas Schwab wrote: > 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, 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. > Here is the updated patch I am checking in. H.J. --- Since abstime passed to pthread_{clock|timed}join_np may be NULL, 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..0baba1e83d 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 != 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..6ade58853c 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 != 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) -- 2.26.2