stay in tstop() as long as the process is stopped
authorSimon Schubert <corecode@dragonflybsd.org>
Sat, 7 Mar 2009 16:54:37 +0000 (17:54 +0100)
committerSimon Schubert <simon.schubert@epfl.ch>
Mon, 9 Mar 2009 17:00:02 +0000 (18:00 +0100)
commitea59a6970871b4b25090ac678008c87a3b0f35a9
tree08ed78c8620021a6695e1b1154a32b62ca4654bf
parentef1c4d7f6c17ef9dfc624e1e0427ccfb7227dba8
stay in tstop() as long as the process is stopped

Under some conditions (mainly related to multi-threaded processes and
tracing (gdb)), wakeups, scheduling and stops can lead to a race which
will leave the process stopped and wait()ed, but the P_WAITED flag
cleared.  This happens because a thread in tstop() might have been woken
up, but not yet scheduled.  If the process in turn would get stopped
again (another bug), the thread in tstop() would be counted as stopped,
but would only be waiting to be scheduled to transition into LSRUN.

Prevent this by checking for SSLEEP in tstop() before returning.
sys/kern/kern_synch.c