From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13798 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Draft outline of thread-list design Date: Thu, 14 Feb 2019 19:20:02 -0500 Message-ID: <20190215002002.GZ23599@brightrain.aerifal.cx> References: <20190212182625.GA24199@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="91082"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-13814-gllmg-musl=m.gmane.org@lists.openwall.com Fri Feb 15 01:20:17 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1guREm-000Nax-R9 for gllmg-musl@m.gmane.org; Fri, 15 Feb 2019 01:20:16 +0100 Original-Received: (qmail 24004 invoked by uid 550); 15 Feb 2019 00:20:14 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 23985 invoked from network); 15 Feb 2019 00:20:14 -0000 Content-Disposition: inline In-Reply-To: <20190212182625.GA24199@brightrain.aerifal.cx> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:13798 Archived-At: On Tue, Feb 12, 2019 at 01:26:25PM -0500, Rich Felker wrote: > Here's a draft of the thread-list design, proposed previously as a > better way to do dynamic TLS installation, and now as a solution to > the problem of __synccall's use of /proc/self/task being (apparently > hopelessly) broken: > > > > Goal of simplicity and correctness, not micro-optimizing. > > List lock is fully AS-safe. Taking lock requires signals be blocked. To elaborate on this: application signals must be blocked before the lock is taken, but implementation signals (particularly the synccall signal) must not be blocked. Otherwise there is a deadlock: it's possible that thread A is waiting for the thread list lock, and thread B holds the thread list lock and is waiting for thread A to respond to a synccall signal before it can make forward progress. If we want to block *all* signals, which is needed at detached thread exit to prevent delivery in the absence of a stack, they must be blocked after obtaining the thread list lock. Rich