Fix possible lockup when ptrace()'ing multi-lwp process.
authorSimon Schubert <corecode@dragonflybsd.org>
Thu, 6 Dec 2007 15:03:25 +0000 (15:03 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Thu, 6 Dec 2007 15:03:25 +0000 (15:03 +0000)
Submitted-by: Nicolas Thery <nthery@gmail.com>
DragonFly-bug:  <http://bugs.dragonflybsd.org/issue761>

sys/kern/kern_sig.c
sys/kern/kern_synch.c

index bead04b..60487f7 100644 (file)
@@ -37,7 +37,7 @@
  *
  *     @(#)kern_sig.c  8.7 (Berkeley) 4/18/94
  * $FreeBSD: src/sys/kern/kern_sig.c,v 1.72.2.17 2003/05/16 16:34:34 obrien Exp $
- * $DragonFly: src/sys/kern/kern_sig.c,v 1.85 2007/11/06 20:21:06 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_sig.c,v 1.86 2007/12/06 15:03:25 corecode Exp $
  */
 
 #include "opt_ktrace.h"
@@ -1357,6 +1357,7 @@ proc_unstop(struct proc *p)
                         * in the meantime.
                         */
                        if (lp->lwp_flag & LWP_WSTOP) {
+                               lp->lwp_flag &= ~LWP_WSTOP;
                                --p->p_nstopped;
                        } else {
                                if (bootverbose)
@@ -1370,7 +1371,6 @@ proc_unstop(struct proc *p)
                        break;
 
                }
-               lp->lwp_flag &= ~LWP_WSTOP;
        }
        crit_exit();
 }
index 1ce1637..0c33e2c 100644 (file)
@@ -37,7 +37,7 @@
  *
  *     @(#)kern_synch.c        8.9 (Berkeley) 5/19/95
  * $FreeBSD: src/sys/kern/kern_synch.c,v 1.87.2.6 2002/10/13 07:29:53 kbyanc Exp $
- * $DragonFly: src/sys/kern/kern_synch.c,v 1.87 2007/08/11 18:18:30 dillon Exp $
+ * $DragonFly: src/sys/kern/kern_synch.c,v 1.88 2007/12/06 15:03:25 corecode Exp $
  */
 
 #include "opt_ktrace.h"
@@ -1019,6 +1019,7 @@ tstop(void)
        }
        tsleep(lp->lwp_proc, 0, "stop", 0);
        p->p_nstopped--;
+       lp->lwp_flag &= ~LWP_WSTOP;
        crit_exit();
 }