|
2016-03-21
| ||
| 12:12 | • Closed ticket [d3071887db]: Fix SEGV in Tcl_FinalizeNotifier() plus 7 other ... artifact: 957fa6bece user: jan.nijtmans | |
| 12:08 | (cherry-pick): Fix [d3071887dbc7aeac]: Fix SEGV in Tcl_FinalizeNotifier(). Thanks to hirofumi for bo... check-in: df0f0d57b3 user: jan.nijtmans tags: core-8-5-branch | |
| 12:03 | (cherry-pick): Fix [d3071887dbc7aeac]: Fix SEGV in Tcl_FinalizeNotifier(). Thanks to hirofumi for bo... check-in: c0e6064843 user: jan.nijtmans tags: core-8-6-branch | |
| 11:59 | Fix [d3071887dbc7aeac]: Fix SEGV in Tcl_FinalizeNotifier(). Thanks to hirofumi for both the bug-repo... check-in: a8ea065823 user: jan.nijtmans tags: trunk | |
| 09:05 | Proposed fix for [d3071887dbc7aeac]: Fix SEGV in Tcl_FinalizeNotifier() check-in: 7636c287f5 user: jan.nijtmans tags: bug-d3071887dbc7aeac | |
|
2016-03-20
| ||
| 12:13 | • Ticket [d3071887db] Fix SEGV in Tcl_FinalizeNotifier() status still Open wit... artifact: 6c88d21ccb user: anonymous | |
|
2016-03-18
| ||
| 16:46 | • New ticket [d3071887db]. artifact: 3a01934725 user: anonymous | |
Fix SEGV in Tcl_FinalizeNotifier()
Closed / Fixedd3071887dbc7aeac5f5f71741239720e9f72584cCreated 11 years agoUpdated 11 years ago
Descriptionplain2016-03-18 16:46:22
When closing wish, process die at
pthread_cond_wait(¬ifierCV, ¬ifierMutex);
if cpu is supporting HLE/RTM. (xend instruction doesn't allow to use without
xbegin)
I.e. Tcl_FinalizeNotifier() is using combination
pthread_mutex_lock(¬ifierInitMutex);
pthread_cond_wait(¬ifierCV, ¬ifierMutex);
pthread_mutex_unlock(¬ifierInitMutex);
From history, this is clearly conversion mistake. notifierInitMutex should be
notifierMutex (no Init).
---
unix/tclUnixNotfy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -puN unix/tclUnixNotfy.c~fix-mutex-typo unix/tclUnixNotfy.c
--- tcl8.6-8.6.5+dfsg/unix/tclUnixNotfy.c~fix-mutex-typo 2016-03-19 01:25:29.900145502 +0900
+++ tcl8.6-8.6.5+dfsg-hirofumi/unix/tclUnixNotfy.c 2016-03-19 01:24:20.795871648 +0900
@@ -417,7 +417,7 @@ Tcl_FinalizeNotifier(
#ifdef TCL_THREADS
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- pthread_mutex_lock(¬ifierInitMutex);
+ pthread_mutex_lock(¬ifierMutex);
notifierCount--;
/*
@@ -460,7 +460,7 @@ Tcl_FinalizeNotifier(
#endif /* __CYGWIN__ */
tsdPtr->waitCVinitialized = 0;
- pthread_mutex_unlock(¬ifierInitMutex);
+ pthread_mutex_unlock(¬ifierMutex);
#endif /* TCL_THREADS */
}
}
_
anonymous (claiming to be [email protected])plain2016-03-20 12:13:48
Then another (better) candidate is the following, instead to remove
notiferInitMutex protection.
pthread_mutex_lock(¬ifierInitMutex);
pthread_mutex_lock(¬ifierMutex);
pthread_cond_wait(¬ifierCV, ¬ifierMutex);
pthread_mutex_unlock(¬ifierMutex);
pthread_mutex_unlock(¬ifierInitMutex);
Because notifierCV is protected by notifierMutex in other places
(StartNotifierThread and NotifierThreadProc). So without notifierMutex
lock, it would be wrong way (has possibility of race). And notiferInitMutex
protects "notifierCount", etc.
I tested the following, and it seems to be working.
---
debian/changelog | 6 ++++++
unix/tclUnixNotfy.c | 2 ++
2 files changed, 8 insertions(+)
diff -puN unix/tclUnixNotfy.c~fix-mutex-typo unix/tclUnixNotfy.c
--- tcl8.6-8.6.5+dfsg/unix/tclUnixNotfy.c~fix-mutex-typo 2016-03-19 01:56:33.736475677 +0900
+++ tcl8.6-8.6.5+dfsg-hirofumi/unix/tclUnixNotfy.c 2016-03-20 20:42:03.421497517 +0900
@@ -433,9 +433,11 @@ Tcl_FinalizeNotifier(
"unable to write q to triggerPipe");
}
close(triggerPipe);
+ pthread_mutex_lock(¬ifierMutex);
while(triggerPipe != -1) {
pthread_cond_wait(¬ifierCV, ¬ifierMutex);
}
+ pthread_mutex_unlock(¬ifierMutex);
if (notifierThreadRunning) {
int result = pthread_join((pthread_t) notifierThread, NULL);
jan.nijtmansplain2016-03-21 12:12:15
Fixed now in all active branches. Thanks for the report and the fix!
Log in (anonymous is fine) to add a comment.