svn commit: r368190 - head/lib/libthr/thread

Konstantin Belousov kib at FreeBSD.org
Mon Nov 30 17:00:36 UTC 2020


Author: kib
Date: Mon Nov 30 17:00:36 2020
New Revision: 368190
URL: https://svnweb.freebsd.org/changeset/base/368190

Log:
  Ensure that threading library is initialized in pthread_mutex_init().
  
  We need at least thr_malloc ready.  The situation is possible e.g. in case
  of libthr being listed in DT_NEEDED before some of its consumers.
  
  Reported and tested by:	lev
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/lib/libthr/thread/thr_mutex.c

Modified: head/lib/libthr/thread/thr_mutex.c
==============================================================================
--- head/lib/libthr/thread/thr_mutex.c	Mon Nov 30 16:18:33 2020	(r368189)
+++ head/lib/libthr/thread/thr_mutex.c	Mon Nov 30 17:00:36 2020	(r368190)
@@ -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)


More information about the svn-src-all mailing list