From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10385 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Duplicate call to pthread_join segvs Date: Thu, 18 Aug 2016 08:47:49 -0400 Message-ID: <20160818124749.GM15995@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1471524486 25970 195.159.176.226 (18 Aug 2016 12:48:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 Aug 2016 12:48:06 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-10398-gllmg-musl=m.gmane.org@lists.openwall.com Thu Aug 18 14:48:03 2016 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.84_2) (envelope-from ) id 1baMjq-0006bE-Sl for gllmg-musl@m.gmane.org; Thu, 18 Aug 2016 14:48:03 +0200 Original-Received: (qmail 22517 invoked by uid 550); 18 Aug 2016 12:48:01 -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 22474 invoked from network); 18 Aug 2016 12:48:01 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:10385 Archived-At: On Thu, Aug 18, 2016 at 12:51:23PM +0100, Steve Osselton wrote: > Hi, > > Am using musl on the latest Alpine Linux release. Although the behaviour of > calling pthread_join on > the same thread is undefined, would be nice if returned an errno as opposed > to a segv: No, that would be harmful because it would hide an extremely serious bug (think what happens if another thread had been created after the first join and its id happened to match the id of the already-joined one). It would also be generally impossible to produce. pthread_join is inherently a free-type operation (it frees a resource) and double-frees are not reliably detectable unless the implementation just never reuses freed resources at all (i.e. leak them). Rich