From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2120 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: TLS (thread-local storage) support Date: Tue, 16 Oct 2012 19:29:28 -0400 Message-ID: <20121016232927.GU254@brightrain.aerifal.cx> References: <20121004211332.GA12874@brightrain.aerifal.cx> <20121004223631.GL254@brightrain.aerifal.cx> <20121016220922.GO24157@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1350430697 28529 80.91.229.3 (16 Oct 2012 23:38:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Oct 2012 23:38:17 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2121-gllmg-musl=m.gmane.org@lists.openwall.com Wed Oct 17 01:38:25 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TOGiH-0007U0-T2 for gllmg-musl@plane.gmane.org; Wed, 17 Oct 2012 01:38:18 +0200 Original-Received: (qmail 1478 invoked by uid 550); 16 Oct 2012 23:38:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 1470 invoked from network); 16 Oct 2012 23:38:10 -0000 Content-Disposition: inline In-Reply-To: <20121016220922.GO24157@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2120 Archived-At: On Wed, Oct 17, 2012 at 12:09:22AM +0200, Szabolcs Nagy wrote: > most functions in musl may be run before pthread_self_init > (it runs on demand when a pthread function is used) This is tangential, but I've been considering changing that for a long time. My thought is to have startup code always attempt to setup the thread pointer (except in static binaries where it's statically determined that nothing will use it). If it failed with ENOSYS (missing syscall due to old kernel), musl would save a flag indicating such and have minimal support code to prevent crashing when using "plain libc" functions that have nothing to do with threads, so that old/simple software can run even on Linux 2.4. If it failed with any other reason (shouldn't be able to happen, but Linux is always introducing stupid resource-exhaustion reasons things can fail...) a_crash would be called before execution passes to the application code. Rich