From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by sourceware.org (Postfix) with ESMTPS id 098C43844007 for ; Thu, 27 May 2021 16:57:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 098C43844007 Received: by mail-qt1-x834.google.com with SMTP id t20so698004qtx.8 for ; Thu, 27 May 2021 09:57: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:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YB6Zw+WoumPYh1TYHliAPvAd9QtLt8RFI9HUNEx36gE=; b=oNvNw/mlrkbAfrSVhx7G3hGyAVxOrL6qejvV+w6gMPf0AIe/w8yqhFbbYFlidKe7d3 shWyXbhM3/+PzeapGx1obFkEPhI87rk3OP0HaZcjvYOSTf6hWrbxQJo+1raGit/7ydPO xmbhDowY92XoiQudaiY8f9rK2oz6YtsJR3AOgkw8CzyFEg1skfqsXfE0PU2Mr6BbUTVq LkeD8/igsrJhrlFY0YlmwJuWTB558d2IAoc+saCW4kIJ3U59gFjJPXNKcO7JoOG/SXTd 4UOVYccRFHMi+kIn6qyPwL4Sw9ZjBrYAzZC0ZnrVJcpfJcnNb07lodoSHgk9LCEPxjBF XghQ== X-Gm-Message-State: AOAM530c8kk9IaTnIeQvdY9LBMZqg9u0wqRpwunSuy8xB/DFYlc3K4dO lwtYwtdCi5X1uju38g7tU8fuQh99vmROng== X-Google-Smtp-Source: ABdhPJzqZKZm+r5IEsNkFxjMxGU7lczBBZ68HT/6rS1i0rtTexNlVrVGSeN39w3L2b6rFVtzkXgJNg== X-Received: by 2002:a05:622a:392:: with SMTP id j18mr4034125qtx.29.1622134668229; Thu, 27 May 2021 09:57:48 -0700 (PDT) Received: from [192.168.1.4] ([177.194.37.86]) by smtp.gmail.com with ESMTPSA id m4sm1776055qtg.21.2021.05.27.09.57.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 May 2021 09:57:48 -0700 (PDT) Subject: Re: [PATCH 08/11] nptl: Move cancel state out of cancelhandling To: Florian Weimer Cc: Adhemerval Zanella via Libc-alpha References: <20210526165728.1772546-1-adhemerval.zanella@linaro.org> <20210526165728.1772546-9-adhemerval.zanella@linaro.org> <87y2c1pda2.fsf@oldenburg.str.redhat.com> <9ca99c3f-f65a-cd4e-4ee9-a6746093f871@linaro.org> <871r9sm8bz.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Message-ID: Date: Thu, 27 May 2021 13:57:45 -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: <871r9sm8bz.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: Thu, 27 May 2021 16:57:50 -0000 On 27/05/2021 13:48, Florian Weimer wrote: > * Adhemerval Zanella: > >> On 26/05/2021 15:20, Florian Weimer wrote: >>> * Adhemerval Zanella via Libc-alpha: >>> >>>> diff --git a/nptl/descr.h b/nptl/descr.h >>>> index a120365f88..a3084fdf60 100644 >>>> --- a/nptl/descr.h >>>> +++ b/nptl/descr.h >>> >>>> @@ -407,6 +401,10 @@ struct pthread >>>> /* Used on strsignal. */ >>>> struct tls_internal_t tls_state; >>>> >>>> + /* Thread cancel state (PTHREAD_CANCEL_ENABLE or >>>> + PTHREAD_CANCEL_DISABLE). */ >>>> + unsigned char cancelstate; >>> >>> You could move this into the padding after the c11 flag, I think. >> >> Right, I moved to below c11. What kind of constraint we have for the >> 'struct pthread' regarding its internal member layout? We have a couple >> of unused fields and might be good to clean them up. > > The sanitizers depend on the size to derive the TLS memory area from the > thread pointer. Yeah, but they use a map to version and size to get the correct size. If we change the size, sanitizer might fix with a new entry in the map. > >>> I think there is an implied dependency on PTHREAD_CANCEL_ENABLE == 0 in >>> __tls_init_tp and somewhere in pthread_create. Maybe add a static >>> assert for PTHREAD_CANCEL_ENABLE == 0? >> >> I think it would be better to add an initialization on __tls_init_tp, >> similar to get_cached_stack. It would be better if we consolidate >> the 'struct pthread' initialization in a common place. > > We depend a lot on zero initialization, though. Maybe it would be > better to use memset in get_cached_stack. Unrelated change, of course. Indeed, but implicit initialization is usually harder to understand specially in this case where it is done in multiple places.