From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by sourceware.org (Postfix) with ESMTPS id 2E1193982C2A for ; Tue, 1 Jun 2021 13:10:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2E1193982C2A Received: by mail-qt1-x82c.google.com with SMTP id l7so747569qtk.5 for ; Tue, 01 Jun 2021 06:10:46 -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=HYjpqOqBMUC6jPhvJMXIeFSkHdjnAp5apXhFkxXR0/4=; b=tj300U7xcRyMtqT7ud0pYrVRYQSudhPzPrgQcasCP47dKle7ez8E32g1ua1+x7IeEw LqJw1EjMphuB7xjrpjJrM6GTnXgUwy8RypK8DTYWsmuSE2L5L1b/8VUPDTYLVo5Oh+X4 hc2LMJxwhJeSFHP2uH7rv+svK7Yrepsfg829XB+c84sEwjRrpk0TN/Mo+ftTo2d/ngl6 jgNataVbpCDMpIn22OLgJZNeKX1Il7qAhuTLBqO+sJSsG4TxkTd1TlQdBdvjLvpHO+6y u1jsJC75csnFk57BYxLvxzQCUqS1QSKfGjrykXIsg6M9YHQlxzKfbDW78zLx8csdTukf 3DGg== X-Gm-Message-State: AOAM530jGUVL6zT5I2TaVypHWXpLs0ekboH6+hjpJqRhIZqHfG/XNDVD G8t9sV5fJ8QjJksAjf9+cZVycQ== X-Google-Smtp-Source: ABdhPJz2Ihfz526AlR9sdpLPcD9gaYL0A0v97GDWO1zVnOm+xiwCoMENFGPFjIiaZewzwRWy4nRO/g== X-Received: by 2002:a05:622a:1189:: with SMTP id m9mr19206365qtk.277.1622553045728; Tue, 01 Jun 2021 06:10:45 -0700 (PDT) Received: from [192.168.1.4] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id g133sm3013007qke.22.2021.06.01.06.10.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jun 2021 06:10:45 -0700 (PDT) Subject: Re: [PATCH v2 3/9] nptl: Install cancellation handler on pthread_cancel To: Florian Weimer , Adhemerval Zanella via Libc-alpha References: <20210527172823.3461314-1-adhemerval.zanella@linaro.org> <20210527172823.3461314-4-adhemerval.zanella@linaro.org> <87k0ne6ktm.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella Message-ID: Date: Tue, 1 Jun 2021 10:10:43 -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: <87k0ne6ktm.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=-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: Tue, 01 Jun 2021 13:10:55 -0000 On 01/06/2021 05:38, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> On 27/05/2021 14:28, Adhemerval Zanella wrote: >>> Now that cancellation is not used anymore to handle thread setup >>> creation failure, the sighandle can be installed only when >>> pthread_cancel is actually used. >>> >>> Checked on x86_64-linux-gnu and aarch64-linux-gnu. >> >> I also think it fixes BZ#14744, the cancellation handler is now used >> solely when pthread_cancel is actually issue. The sigcancel_handler >> already prevents signals from other processes and cancellation from >> other processes are an extension that I think it does not really >> make sense (as Carlos has pointed ack on the bug report). > > I'm not sure if bug 14744 actually exists, given the checks we have in > the cancellation signal handler. Particularly the si_pid check should > block acting on signals sent from another process. And locally, we > filter out the NPTL signals in the system call wrapppers (and we > consider direct system calls undefined in this context). Indeed there is not the issue of external processes cancelling random threads by throwing SIGCANCEL to random tids, I was referring to the robustness suggestion to just install the signal handler when pthread_cancel is actually used as per comment #1 (although it would only help by invoking the default signal handler).