From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12639 Path: news.gmane.org!.POSTED!not-for-mail From: Jens Gustedt Newsgroups: gmane.linux.lib.musl.general Subject: Re: segmentation fault on pthread_detach Date: Tue, 27 Mar 2018 14:32:55 +0200 Organization: inria.fr Message-ID: <20180327143255.67c8b2c5@inria.fr> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/7e/f.dWbJuCW5F0p0k+_m.D"; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1522153880 21770 195.159.176.226 (27 Mar 2018 12:31:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Mar 2018 12:31:20 +0000 (UTC) Cc: musl@lists.openwall.com To: Original-X-From: musl-return-12653-gllmg-musl=m.gmane.org@lists.openwall.com Tue Mar 27 14:31:16 2018 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 1f0nku-0005UN-Nj for gllmg-musl@m.gmane.org; Tue, 27 Mar 2018 14:31:12 +0200 Original-Received: (qmail 9282 invoked by uid 550); 27 Mar 2018 12:33:10 -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 8160 invoked from network); 27 Mar 2018 12:33:08 -0000 X-IronPort-AV: E=Sophos;i="5.48,367,1517871600"; d="scan'208";a="320194366" In-Reply-To: X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAACRQTFRFERslNjAsLTE9Ok9wUk9TaUs8iWhSrYZkj42Rz6aD3sGZ Xref: news.gmane.org gmane.linux.lib.musl.general:12639 Archived-At: --Sig_/7e/f.dWbJuCW5F0p0k+_m.D Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello Salman, On Tue, 27 Mar 2018 12:00:39 +0000 wrote: > My application using musl libc runs into a seg fault if I call > pthread_detach after pthread_join on the same thread. From my > understanding pthread_detach should return ESRCH if a previous join > was called on a particular thread. That=E2=80=99s the correct behavior I = see > if I run my program with glibc. But on my LEDE based router I run > into the seg fault issue. The cross compiling toolchain I use is > arm_cortex-a9+neon_gcc-5.4.0_musl-1.1.16_eabi. Simple example I used > for testing is below. I don't think that your expectation is correct. The POSIX standard states: > The behavior is undefined if the value specified by the thread argument > to pthread_detach() does not refer to a joinable thread. (a thread that has already been joined is not joinable) This is for good reasons. The system must be able to dispose of all resources that a thread occupied after it has been joined. The memory will be reused, in particular there may be a new thread that uses the same identifier. Jens --=20 :: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS ::: :: ::::::::::::::: office Strasbourg : +33 368854536 :: :: :::::::::::::::::::::: gsm France : +33 651400183 :: :: ::::::::::::::: gsm international : +49 15737185122 :: :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt :: --Sig_/7e/f.dWbJuCW5F0p0k+_m.D Content-Type: application/pgp-signature Content-Description: Digitale Signatur von OpenPGP -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSN9stI2OFN1pLljN0P0+hp2tU34gUCWro59wAKCRAP0+hp2tU3 4t8oAJsE4juXE1DnNyLCfK0N96aQrLpKkACcCneJbN66uVew1cnpLGpO0zTwqAk= =b61b -----END PGP SIGNATURE----- --Sig_/7e/f.dWbJuCW5F0p0k+_m.D--