From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 6E8133953819 for ; Thu, 27 May 2021 07:44:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6E8133953819 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-bYUgvgNMPleVhEljKWOKfw-1; Thu, 27 May 2021 03:43:58 -0400 X-MC-Unique: bYUgvgNMPleVhEljKWOKfw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 02BCD803622; Thu, 27 May 2021 07:43:57 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-113-228.ams2.redhat.com [10.36.113.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3937C687E8; Thu, 27 May 2021 07:43:56 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 05/11] nptl: Deallocate the thread stack on setup failure (BZ #19511) References: <20210526165728.1772546-1-adhemerval.zanella@linaro.org> <20210526165728.1772546-6-adhemerval.zanella@linaro.org> <8b167010-9214-abc5-169e-ce1008c15749@linaro.org> Date: Thu, 27 May 2021 09:43:54 +0200 In-Reply-To: <8b167010-9214-abc5-169e-ce1008c15749@linaro.org> (Adhemerval Zanella's message of "Wed, 26 May 2021 16:26:51 -0300") Message-ID: <87k0nkoc3p.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Thu, 27 May 2021 07:44:04 -0000 * Adhemerval Zanella: > On 26/05/2021 13:57, Adhemerval Zanella wrote: >> @@ -435,10 +424,11 @@ start_thread (void *arg) >> >> /* And give it up right away. */ >> lll_unlock (pd->lock, LLL_PRIVATE); >> - >> - LIBC_CANCEL_RESET (oldtype); >> } >> >> + if (pd->setup_failed == 1) >> + __do_cancel (); >> + >> LIBC_PROBE (pthread_start, 3, (pthread_t) pd, pd->start_routine, pd->arg); >> >> /* Run the code the user provided. */ > > And this is wrong, the created thread does not own the PD anymore > since for setup_failed == 1, pd->stopped_start will be true. > > We need to call __do_cancel in the if above. Okay, I will wait for the new version before I start a real review. Thanks, Florian