Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 2019 13:24:31 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352620 - head/lib/libthr/thread
Message-ID:  <201909231324.x8NDOV7J005751@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909231324.x8NDOV7J005751>