12-STABLE try to init thead-using libraries before threads and program crashes

Lev Serebryakov lev at FreeBSD.org
Thu Dec 3 11:04:17 UTC 2020


On 27.11.2020 20:03, Konstantin Belousov wrote:

> libthr is cleanly linked too early, it should come after all consumers.
> Anyway, try this.
> 
> diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
> index 57984ef6d0e..303386db7fe 100644
> --- a/lib/libthr/thread/thr_mutex.c
> +++ b/lib/libthr/thread/thr_mutex.c
> @@ -384,6 +384,8 @@ __Tthr_mutex_init(pthread_mutex_t * __restrict mutex,
>   	struct pthread_mutex *pmtx;
>   	int ret;
>   
> +	_thr_check_init();
> +
>   	if (mutex_attr != NULL) {
>   		ret = mutex_check_attr(*mutex_attr);
>   		if (ret != 0)
> 

  It helps!

-- 
// Lev Serebryakov


More information about the freebsd-stable mailing list