Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 27 Mar 2018 14:32:55 +0200
From: Jens Gustedt <>
To: <>
Subject: Re: segmentation fault on pthread_detach

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’s 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

> 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.


:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: ::

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.