aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-09-23 13:24:31 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2019-09-23 13:24:31 +0000
commitf9bf9282c9803ebc6774f3de6a566d84aaa8f192 (patch)
tree7b4dbc3c8e4c3e2b8ee6eb5ba847b90920d9a7ce /lib
parent2e6a21bbd8416c532a4c207caf01e7d2b47f7327 (diff)
downloadsrc-f9bf9282c9803ebc6774f3de6a566d84aaa8f192.tar.gz
src-f9bf9282c9803ebc6774f3de6a566d84aaa8f192.zip
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
Notes
Notes: svn path=/head/; revision=352620
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_mutex.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index dc09f539add5..57984ef6d0e6 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -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;