summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-05-23 10:28:13 +0000
committermtm <mtm@FreeBSD.org>2003-05-23 10:28:13 +0000
commit20c957b6445e84b6573001be2b41a479a6fc7d1e (patch)
treeda35acaaed6829d2ee3417124efd54aaecc7128a /lib/libthr
parent6356a9c88e04455186a9b6d683ace14dadb891b7 (diff)
downloadFreeBSD-src-20c957b6445e84b6573001be2b41a479a6fc7d1e.zip
FreeBSD-src-20c957b6445e84b6573001be2b41a479a6fc7d1e.tar.gz
EDOOFUS
Prevent one thread from messing up another thread's saved signal mask by saving it in struct pthread instead of leaving it as a global variable. D'oh! Approved by: re/blanket libthr
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_kern.c12
-rw-r--r--lib/libthr/thread/thr_private.h1
2 files changed, 3 insertions, 10 deletions
diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c
index 7d10c5f..77b0094 100644
--- a/lib/libthr/thread/thr_kern.c
+++ b/lib/libthr/thread/thr_kern.c
@@ -73,8 +73,7 @@ _thread_critical_enter(pthread_t pthread)
errno);
abort();
}
-
- restore = sav;
+ curthread->savedsig = sav;
}
void
@@ -83,16 +82,9 @@ _thread_critical_exit(pthread_t pthread)
sigset_t set;
/*
- * restore is protected by giant. We could restore our signal state
- * incorrectly if someone else set restore between unlocking giant
- * and restoring the signal mask. To avoid this we cache a copy prior
- * to the unlock.
- */
- set = restore;
-
- /*
* Restore signals.
*/
+ set = curthread->savedsig;
if (__sys_sigprocmask(SIG_SETMASK, &set, NULL)) {
_thread_printf(STDERR_FILENO, "Critical Exit: sig err %d\n",
errno);
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
index f0cfd56..10fdda0 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -425,6 +425,7 @@ struct pthread {
char *name;
u_int64_t uniqueid; /* for gdb */
thr_id_t thr_id;
+ sigset_t savedsig;
/*
* Lock for accesses to this thread structure.
OpenPOWER on IntegriCloud