Date: Fri, 3 Jun 2005 18:10:05 GMT From: =?ISO-8859-1?Q?Se=E1n_C=2E_Farley?= <sean-freebsd@farley.org> To: freebsd-bugs@FreeBSD.org Subject: Re: gnu/77818: GDB locks in wait4() when running applications Message-ID: <200506031810.j53IA5NR074196@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR gnu/77818; it has been noted by GNATS. From: =?ISO-8859-1?Q?Se=E1n_C=2E_Farley?= <sean-freebsd@farley.org> To: David Xu <davidxu@freebsd.org> Cc: bug-followup@freebsd.org Subject: Re: gnu/77818: GDB locks in wait4() when running applications Date: Fri, 3 Jun 2005 13:01:06 -0500 (CDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1475645835-1117821666=:2420 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 3 Jun 2005, David Xu wrote: > Please try following patch, this patch fixes nanosleep problem, > the patch just removed some unnecessary code. > > Index: kern_sig.c <snip> Thank you. That fixed the nanosleep() bug for me. I had to apply the patch by hand since it was against 6-CURRENT. Also, I unsquished some comments. Here is the patch against 5-STABLE: -------------------------------------------------------------- --- kern_sig.c.orig=09Fri Jun 3 07:32:03 2005 +++ kern_sig.c=09Fri Jun 3 07:50:56 2005 @@ -1689,34 +1689,23 @@ =09} =09/* -=09 * If proc is traced, always give parent a chance; -=09 * if signal event is tracked by procfs, give *that* -=09 * a chance, as well. +=09 * If the signal is being ignored, then we forget about it immediately. +=09 * (Note: we don't set SIGCONT in ps_sigignore, and if it is set to +=09 * SIG_IGN, action will be SIG_DFL here.) =09 */ -=09if ((p->p_flag & P_TRACED) || (p->p_stops & S_SIG)) { -=09=09action =3D SIG_DFL; -=09} else { -=09=09/* -=09=09 * If the signal is being ignored, -=09=09 * then we forget about it immediately. -=09=09 * (Note: we don't set SIGCONT in ps_sigignore, -=09=09 * and if it is set to SIG_IGN, -=09=09 * action will be SIG_DFL here.) -=09=09 */ -=09=09mtx_lock(&ps->ps_mtx); -=09=09if (SIGISMEMBER(ps->ps_sigignore, sig) || -=09=09 (p->p_flag & P_WEXIT)) { -=09=09=09mtx_unlock(&ps->ps_mtx); -=09=09=09return; -=09=09} -=09=09if (SIGISMEMBER(td->td_sigmask, sig)) -=09=09=09action =3D SIG_HOLD; -=09=09else if (SIGISMEMBER(ps->ps_sigcatch, sig)) -=09=09=09action =3D SIG_CATCH; -=09=09else -=09=09=09action =3D SIG_DFL; +=09mtx_lock(&ps->ps_mtx); +=09if (SIGISMEMBER(ps->ps_sigignore, sig) || +=09 (p->p_flag & P_WEXIT)) { =09=09mtx_unlock(&ps->ps_mtx); +=09=09return; =09} +=09if (SIGISMEMBER(td->td_sigmask, sig)) +=09=09action =3D SIG_HOLD; +=09else if (SIGISMEMBER(ps->ps_sigcatch, sig)) +=09=09action =3D SIG_CATCH; +=09else +=09=09action =3D SIG_DFL; +=09mtx_unlock(&ps->ps_mtx); =09if (prop & SA_CONT) { =09=09SIG_STOPSIGMASK(p->p_siglist); @@ -1865,14 +1854,16 @@ =09=09 * Mutexes are short lived. Threads waiting on them will =09=09 * hit thread_suspend_check() soon. =09=09 */ -=09} else if (p->p_state =3D=3D PRS_NORMAL) { -=09=09if ((p->p_flag & P_TRACED) || (action !=3D SIG_DFL) || -=09=09=09!(prop & SA_STOP)) { +=09} else if (p->p_state =3D=3D PRS_NORMAL) { +=09=09if ((p->p_flag & P_TRACED) || action =3D=3D SIG_CATCH) { =09=09=09mtx_lock_spin(&sched_lock); =09=09=09tdsigwakeup(td, sig, action); =09=09=09mtx_unlock_spin(&sched_lock); =09=09=09goto out; =09=09} + +=09=09MPASS(action =3D=3D SIG_DFL); + =09=09if (prop & SA_STOP) { =09=09=09if (p->p_flag & P_PPWAIT) =09=09=09=09goto out; @@ -1955,35 +1946,27 @@ =09=09 */ =09=09if ((td->td_flags & TDF_SINTR) =3D=3D 0) =09=09=09return; + =09=09/* -=09=09 * Process is sleeping and traced. Make it runnable -=09=09 * so it can discover the signal in issignal() and stop -=09=09 * for its parent. +=09=09 * If SIGCONT is default (or ignored) and process is asleep, we +=09=09 * are finished; the process should not be awakened. =09=09 */ -=09=09if (p->p_flag & P_TRACED) { -=09=09=09p->p_flag &=3D ~P_STOPPED_TRACE; -=09=09} else { +=09=09if ((prop & SA_CONT) && action =3D=3D SIG_DFL) { +=09=09=09SIGDELSET(p->p_siglist, sig); =09=09=09/* -=09=09=09 * If SIGCONT is default (or ignored) and process is -=09=09=09 * asleep, we are finished; the process should not -=09=09=09 * be awakened. +=09=09=09 * It may be on either list in this state. +=09=09=09 * Remove from both for now. =09=09=09 */ -=09=09=09if ((prop & SA_CONT) && action =3D=3D SIG_DFL) { -=09=09=09=09SIGDELSET(p->p_siglist, sig); -=09=09=09=09/* -=09=09=09=09 * It may be on either list in this state. -=09=09=09=09 * Remove from both for now. -=09=09=09=09 */ -=09=09=09=09SIGDELSET(td->td_siglist, sig); -=09=09=09=09return; -=09=09=09} - -=09=09=09/* -=09=09=09 * Give low priority threads a better chance to run. -=09=09=09 */ -=09=09=09if (td->td_priority > PUSER) -=09=09=09=09td->td_priority =3D PUSER; +=09=09=09SIGDELSET(td->td_siglist, sig); +=09=09=09return; =09=09} + +=09=09/* +=09=09 * Give low priority threads a better chance to run. +=09=09 */ +=09=09if (td->td_priority > PUSER) +=09=09=09td->td_priority =3D PUSER; + =09=09sleepq_abort(td); =09} else { =09=09/* -------------------------------------------------------------- Now that you have fixed my bugs, I will now have to go find some more to play with. :) Se=E1n --=20 sean-freebsd@farley.org --0-1475645835-1117821666=:2420--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506031810.j53IA5NR074196>