FreeBSD Bugzilla – Attachment 203581 Details for
Bug 237195
pthread_mutex_unlock crash as unlocked mutex destroyed by signaled thread
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Do not access mutex memory after unlock.
1.patch (text/plain), 1.02 KB, created by
Konstantin Belousov
on 2019-04-11 09:37:54 UTC
(
hide
)
Description:
Do not access mutex memory after unlock.
Filename:
MIME Type:
Creator:
Konstantin Belousov
Created:
2019-04-11 09:37:54 UTC
Size:
1.02 KB
patch
obsolete
>diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c >index 4db65384331..9dc38c72377 100644 >--- a/lib/libthr/thread/thr_mutex.c >+++ b/lib/libthr/thread/thr_mutex.c >@@ -949,7 +949,7 @@ mutex_unlock_common(struct pthread_mutex *m, bool cv, int *mtx_defer) > { > struct pthread *curthread; > uint32_t id; >- int deferred, error, robust; >+ int deferred, error, private, robust; > > if (__predict_false(m <= THR_MUTEX_DESTROYED)) { > if (m == THR_MUTEX_DESTROYED) >@@ -967,6 +967,7 @@ mutex_unlock_common(struct pthread_mutex *m, bool cv, int *mtx_defer) > return (EPERM); > > error = 0; >+ private = (m->m_flags & PMUTEX_FLAG_PRIVATE) != 0; > if (__predict_false(PMUTEX_TYPE(m->m_flags) == > PTHREAD_MUTEX_RECURSIVE && m->m_count > 0)) { > m->m_count--; >@@ -991,7 +992,7 @@ mutex_unlock_common(struct pthread_mutex *m, bool cv, int *mtx_defer) > if (robust) > _mutex_leave_robust(curthread, m); > } >- if (!cv && m->m_flags & PMUTEX_FLAG_PRIVATE) >+ if (!cv && private) > THR_CRITICAL_LEAVE(curthread); > return (error); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 237195
:
203579
| 203581 |
203764
|
235730