Path: blob/main/website/static/security/patches/EN-08:01/libpthread.patch
18096 views
Index: lib/libpthread/sys/lock.c1===================================================================2RCS file: /home/ncvs/src/lib/libpthread/sys/Attic/lock.c,v3retrieving revision 1.9.2.14diff -u -r1.9.2.1 lock.c5--- lib/libpthread/sys/lock.c 5 Aug 2005 19:43:56 -0000 1.9.2.16+++ lib/libpthread/sys/lock.c 12 Mar 2008 19:18:47 -00007@@ -117,14 +117,23 @@8{9if (lu == NULL)10return (-1);11- /*12- * All lockusers keep their watch request and drop their13- * own (lu_myreq) request. Their own request is either14- * some other lockuser's watch request or is the head of15- * the lock.16- */17- lu->lu_myreq = lu->lu_watchreq;18- if (lu->lu_myreq == NULL)19+20+ if (lu->lu_watchreq != NULL) {21+ /*22+ * In this case the lock is active. All lockusers23+ * keep their watch request and drop their own24+ * (lu_myreq) request. Their own request is either25+ * some other lockuser's watch request or is the26+ * head of the lock.27+ */28+ lu->lu_myreq = lu->lu_watchreq;29+ lu->lu_watchreq = NULL;30+ }31+ if (lu->lu_myreq == NULL)32+ /*33+ * Oops, something isn't quite right. Try to34+ * allocate one.35+ */36return (_lockuser_init(lu, priv));37else {38lu->lu_myreq->lr_locked = 1;39Index: lib/libpthread/thread/thr_kern.c40===================================================================41RCS file: /home/ncvs/src/lib/libpthread/thread/Attic/thr_kern.c,v42retrieving revision 1.116.2.143diff -u -r1.116.2.1 thr_kern.c44--- lib/libpthread/thread/thr_kern.c 16 Mar 2006 23:29:07 -0000 1.116.2.145+++ lib/libpthread/thread/thr_kern.c 12 Mar 2008 19:19:05 -000046@@ -345,6 +345,17 @@47_LCK_SET_PRIVATE2(&curthread->kse->k_lockusers[i], NULL);48}49curthread->kse->k_locklevel = 0;50+51+ /*52+ * Reinitialize the thread and signal locks so that53+ * sigaction() will work after a fork().54+ */55+ _lock_reinit(&curthread->lock, LCK_ADAPTIVE, _thr_lock_wait,56+ _thr_lock_wakeup);57+ _lock_reinit(&_thread_signal_lock, LCK_ADAPTIVE, _kse_lock_wait,58+ _kse_lock_wakeup);59+60+61_thr_spinlock_init();62if (__isthreaded) {63_thr_rtld_fini();64@@ -354,6 +365,20 @@65curthread->kse->k_kcb->kcb_kmbx.km_curthread = NULL;66curthread->attr.flags |= PTHREAD_SCOPE_SYSTEM;6768+ /*69+ * After a fork, it is possible that an upcall occurs in70+ * the parent KSE that fork()'d before the child process71+ * is fully created and before its vm space is copied.72+ * During the upcall, the tcb is set to null or to another73+ * thread, and this is what gets copied in the child process74+ * when the vm space is cloned sometime after the upcall75+ * occurs. Note that we shouldn't have to set the kcb, but76+ * we do it for completeness.77+ */78+ _kcb_set(curthread->kse->k_kcb);79+ _tcb_set(curthread->kse->k_kcb, curthread->tcb);80+81+82/* After a fork(), there child should have no pending signals. */83sigemptyset(&curthread->sigpend);84858687