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-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-5.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 6A0481F8C6 for ; Thu, 26 Aug 2021 15:12:35 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EB803858001 for ; Thu, 26 Aug 2021 15:12:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EB803858001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629990754; bh=/QGWjEfim/2uVK4tYZ1iU2xceYjVhzH78NWL28OC2ks=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=pg+sUrziA32s37DONNqbdMeBflMDzbuwfMFW0nA9wCcHVUUnAdq2RfzSbJQDLqlw7 ImYuVMqOYsBT0a4NKr+6Jc3axzsua6dhAuc9V511VPBFrEwFDcRP4h/jmu3jsYncrX beQjvCfGlnL6AHTy3F5vHnUSpEbEK60bX5rXTfNA= Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by sourceware.org (Postfix) with ESMTPS id A614E385843B for ; Thu, 26 Aug 2021 15:11:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A614E385843B Received: by mail-qk1-x735.google.com with SMTP id a66so3745680qkc.1 for ; Thu, 26 Aug 2021 08:11:37 -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=/QGWjEfim/2uVK4tYZ1iU2xceYjVhzH78NWL28OC2ks=; b=UIy1yTO7yOcQdbBDj40yY3EoCKDvzdTVStC7fmnKULH5qblyiGbJ5zV3Mdxu1bm1T6 /FTXnsAYUer67OFleT1LPKjr5ZeCyxQRbix5Q3+r1lUE0YlJFTWIN8ctg6epszBiL2KM dK6/T/kGecSD/L5o+qjMJaYjke0HDhMnckXC2a8apnrAHVH77UiT2tEWQy6A5o/0fJ22 OYrk/L1CoLS1PDbsyQ53icCb6GXl7l48Emiibw+zwZhgyFb3ehpvb0MAGO282Ga2qpBn /m2DqdMRVkIUWQ3Hp0eR8nfk2zKY0pe4su/onn9A6J7wEiio0mYb2/UA+i9ypgrUXSJa mI0w== X-Gm-Message-State: AOAM5338wMwaVDfiiegWHSNOEowXu9dYQwKPYYYFvXvt1al/PwM/QGAS LM4rVlPl4hSS92MrhC+QuJgmLicWzVD+Rg== X-Google-Smtp-Source: ABdhPJw+/WXpwncaVbWZ8EmBKgqdHswsnH9evkCf/wMBS8vd6vnoqtXq+s/GJF8yANZBLe6J3wFW1g== X-Received: by 2002:a37:944:: with SMTP id 65mr4278687qkj.412.1629990696990; Thu, 26 Aug 2021 08:11:36 -0700 (PDT) Received: from ?IPv6:2804:431:c7ca:1a68:4e82:9e7c:b7e4:7f3? ([2804:431:c7ca:1a68:4e82:9e7c:b7e4:7f3]) by smtp.gmail.com with ESMTPSA id g13sm2765761qkk.110.2021.08.26.08.11.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Aug 2021 08:11:36 -0700 (PDT) Subject: Re: [PATCH v2 05/19] nptl: Move setxid flag out of cancelhandling To: Florian Weimer References: <20210823195047.543237-1-adhemerval.zanella@linaro.org> <20210823195047.543237-6-adhemerval.zanella@linaro.org> <87tujc783g.fsf@oldenburg.str.redhat.com> Message-ID: Date: Thu, 26 Aug 2021 12:11:34 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <87tujc783g.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 26/08/2021 08:34, Florian Weimer wrote: > * Adhemerval Zanella: > >> Now that the thread state is tracked by 'joinstate' field, there is no >> need to keep the setxid flag within the 'cancelhandling'. It simplifies >> the atomic code to set and reset it (since there is no need to handle >> the thread state concurrent update). > > Some of this functionality reimplements the tidlock. > > There is some functionality around thread creation, but I do not know if > the synchronization is entirely correct. This makes it rather difficult > to review changes. > > It's also not clear to me if we need to do anything to prevent early > setxid calls: > >> /* Don't allow setxid until cloned. */ > > I suspect this should just look at the TID instead. We create the > thread with all signals blocked, so once there is a TID (and the thread > has not exited), it is safe to send the signal. I agree that we might improve the setxid code, however what I intended with this changes is to keep its semantic as-is and just decouple it from cancelhandling. I might revise it on a later patch to follow your suggestions. > >> diff --git a/nptl/descr.h b/nptl/descr.h >> index 4b2db6edab..563b152bff 100644 >> --- a/nptl/descr.h >> +++ b/nptl/descr.h > >> + /* Indicate whether thread is supposed to change XID. */ >> + int setxid_flag; > > This should document the possible values. I changed to: /* Indicate whether thread is supposed to change XID, it acts a boolean variable (0 means no operation pending). */