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

Konstantin Belousov kib at FreeBSD.org
Mon Sep 23 13:24:32 UTC 2019


Author: kib
Date: Mon Sep 23 13:24:31 2019
New Revision: 352620
URL: https://svnweb.freebsd.org/changeset/base/352620

Log:
  Fix destruction of the robust mutexes.
  
  If robust mutex' owner terminated, causing kernel-assisted state
  recovery, and then pthread_mutex_destroy() is executed as the next
  action, assert is triggered about mutex still being on the list.
  Ignore the mutex linkage in pthread_mutex_destroy() for shared robust
  mutexes with dead owner, same as for enqueue_mutex().
  
  Reported by:	avg
  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 Sep 23 12:43:08 2019	(r352619)
+++ head/lib/libthr/thread/thr_mutex.c	Mon Sep 23 13:24:31 2019	(r352620)
@@ -474,7 +474,11 @@ _thr_mutex_destroy(pthread_mutex_t *mutex)
 		if (m == THR_PSHARED_PTR) {
 			m1 = __thr_pshared_offpage(mutex, 0);
 			if (m1 != NULL) {
-				mutex_assert_not_owned(_get_curthread(), m1);
+				if ((uint32_t)m1->m_lock.m_owner !=
+				    UMUTEX_RB_OWNERDEAD) {
+					mutex_assert_not_owned(
+					    _get_curthread(), m1);
+				}
 				__thr_pshared_destroy(mutex);
 			}
 			*mutex = THR_MUTEX_DESTROYED;


More information about the svn-src-head mailing list