Mateusz Guzik 2ca66c1ef5 Fix process exit vs reap race introduced in r329449
The race manifested itself mostly in terms of crashes with "spin lock
held too long".

Relevant parts of respective code paths:

exit:				reap:
PROC_LOCK(p);
PROC_SLOCK(p);
p->p_state == PRS_ZOMBIE
PROC_UNLOCK(p);
				PROC_LOCK(p);
/* exit work */
				if (p->p_state == PRS_ZOMBIE) /* true */
					proc_reap()
					free proc
/* more exit work */
PROC_SUNLOCK(p);

Thus a still exiting process is reaped.

Prior to the change the zombie check was followed by slock/sunlock trip
which prevented the problem.

Even code prior to this commit has a bug: the proc is still accessed for
statistic collection purposes. However, the severity is rather small and
the bug may be fixed in a future commit.

Reported by:	many
Tested by:	allanjude
2018-02-19 00:54:08 +00:00
..
2017-11-30 20:33:45 +00:00
2018-01-03 00:56:30 +00:00
2018-01-03 00:56:30 +00:00
2018-02-19 00:38:14 +00:00
2017-01-25 20:22:32 +00:00
2018-02-07 16:57:10 +00:00
2017-12-13 16:30:39 +00:00
2018-01-24 13:57:01 +00:00
2017-08-07 14:09:57 +00:00
2017-11-30 20:33:45 +00:00
2018-01-12 23:06:35 +00:00
2018-01-22 02:26:10 +00:00
2017-12-01 22:51:02 +00:00