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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 9790 invoked from network); 6 Jul 2020 22:15:01 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 6 Jul 2020 22:15:01 -0000 Received: (qmail 16367 invoked by uid 550); 6 Jul 2020 22:14:57 -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 16349 invoked from network); 6 Jul 2020 22:14:56 -0000 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yqxmail.com; s=dkim; t=1594073684; bh=nYYPZGESfQLjQeM4s1bIaI3salnpQGdqgA3Ob+ua6qg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=eA+1O40wR1Q+TVX4LlCOGdm5P7kt+yu7UGofqNrElZIRISIL7Tb4TAsdh+RWktEGD 54cZUvc6IMBLjtSRq/r+qBMrazv0t66soCvwrkmipItObxE95aKdC+3Ni9u3D0WFxK diKGgdxR+yh8sbyZG3s+hcwlLXzhQuxhPl1E03t0mSTsjUhmMQf1KRUVQOi7ocnT4p jXuIv8l0Hb+Hfei776Ce6hPM4zaUgFeAl1wnisJP42ijgugRvmSE6GOGO+MSbJ+rFw Gwy0SU+Jpj3lxgu/Zqw+SEu7tY8EKlKfXuJzf3quV+Wpz8oWO62Tlano8qWkJ/cPcv 52eCRmtoQh/0A== Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 06 Jul 2020 15:14:43 -0700 From: Hydro Flask To: Rich Felker Cc: musl@lists.openwall.com In-Reply-To: <20200706220024.GJ6430@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> <20200630195409.GH6430@brightrain.aerifal.cx> <300a1bdb9e9041bf05312ef032cbdc66@yqxmail.com> <20200706220024.GJ6430@brightrain.aerifal.cx> Message-ID: Subject: Re: [musl] Potential deadlock in pthread_kill() On 2020-07-06 15:00, Rich Felker wrote: > Yes, I see it clearly now. Sorry it took a while. I have prepared the > attached patch which I'll push soon if there are no problems. Needs one more tiny tweak. I noticed that pthread_cancel() calls pthread_kill(). That means pthread_kill() must be async-cancel-safe. If an asynchronous cancellation happens after pthread_kill() grabs the killlock, then it will deadlock because the asynchronous pthread_exit(PTHREAD_CANCELED) call will then recursively try to grab killlock. The solution as far as I can tell is to not just block app signals when grabbing killlock, but all signals.