From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by sourceware.org (Postfix) with ESMTPS id 37227386FC21 for ; Wed, 26 May 2021 19:26:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 37227386FC21 Received: by mail-qt1-x82a.google.com with SMTP id t17so1750414qta.11 for ; Wed, 26 May 2021 12:26:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/rvOEn61vcD7wnLxTihX/gUceN7wOA9/L31ry3R/vog=; b=FZguaVGJsVX1pYAubNF3DzFAllsgkeFJPQOw99AxTyNKuVE/OelQeeidDvt3XaiZKP Fo6FvhZATqE51kfrCJdM+iOT2xQik1u5289J0kMhF0Qd19eA9KA5i6k88qxhoObGzMhy WB6r2WaX8PdUtsH65AZpUx13PxILF7HdEUuQ4JXY0Kms1O+qQXdyBnB04obV+ZuGg+85 Z7PWiS133cQV3DqAAE5LEpECAddmqn9S+ssUsQPqqZi6dfObtsFAFFq5Sfn68bJlPWmm R/uAxP6tPZyxr6oCqsE0ox9ksb50T0SplPt1zKPHLC8WsMbIhKvctHLyF3j+SL0+Ifam rSRQ== X-Gm-Message-State: AOAM532bj4yU2sWVtkHqzq0UP/+CTSIn6fbRIzIxGvkdS6LOM4XQn4Bs tVXj7OTEuJgLI6ZyjdCJGW+q7g== X-Google-Smtp-Source: ABdhPJxaYo5Rqq0aitg2ii4ZZuIAe7IUng36lR2y/nx5SandJIhqNuWkTWpTvKUe8Sz1RnrOFsqlEQ== X-Received: by 2002:a05:622a:183:: with SMTP id s3mr39092915qtw.115.1622057214745; Wed, 26 May 2021 12:26:54 -0700 (PDT) Received: from [192.168.1.4] ([177.194.37.86]) by smtp.gmail.com with ESMTPSA id n13sm2039276qtl.48.2021.05.26.12.26.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 May 2021 12:26:54 -0700 (PDT) Subject: Re: [PATCH 05/11] nptl: Deallocate the thread stack on setup failure (BZ #19511) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Florian Weimer References: <20210526165728.1772546-1-adhemerval.zanella@linaro.org> <20210526165728.1772546-6-adhemerval.zanella@linaro.org> Message-ID: <8b167010-9214-abc5-169e-ce1008c15749@linaro.org> Date: Wed, 26 May 2021 16:26:51 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210526165728.1772546-6-adhemerval.zanella@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, 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: Wed, 26 May 2021 19:26:56 -0000 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.