From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2442 invoked from network); 30 Jun 2020 19:54:27 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 30 Jun 2020 19:54:27 -0000 Received: (qmail 13929 invoked by uid 550); 30 Jun 2020 19:54:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 13911 invoked from network); 30 Jun 2020 19:54:22 -0000 Date: Tue, 30 Jun 2020 15:54:10 -0400 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20200630195409.GH6430@brightrain.aerifal.cx> References: <0217b8838100175725993b0ed0114ee7@thelig.ht> <20200630044323.GD6430@brightrain.aerifal.cx> <20200630092644.GE6430@brightrain.aerifal.cx> <20200630145851.GD13001@voyager> <275470aa6820d420339929a1fe409d89@yqxmail.com> <477cc243-b950-3363-e9f4-4c8a203b6bea@samersoff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <477cc243-b950-3363-e9f4-4c8a203b6bea@samersoff.net> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Potential deadlock in pthread_kill() On Tue, Jun 30, 2020 at 10:28:50PM +0300, Dmitry Samersoff wrote: > Hello all, > > Does it make sense to trylock and immediately return ESRCH if > pthread_kill is already in progress? No, ESRCH is not a valid result for this condition. Moreover killlock being taken does not tell you that pthread_kill is already in progress targeting the same thread, just that something that needs the kernel tid to be valid (kill, cancel, or scheduling changes) or that needs to change its validity (exiting) is in progress. Note that for fixing this issue, it won't suffice just to make pthread_kill block signals. The other places that use the killlock also need to block signals, to make the lock fully AS-safe. Rich