Work around a kernel panic triggered by forkbomb with an rctl rule

such as j:name:maxproc:sigkill=100.  Proper fix - deferring psignal
to a taskqueue - is somewhat complicated and thus will happen
after 9.0.

Approved by:	re (kib)
This commit is contained in:
Edward Tomasz Napierala 2011-09-06 17:22:40 +00:00
parent aacc74998a
commit 3044751e35
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=225426

View file

@ -362,6 +362,17 @@ rctl_enforce(struct proc *p, int resource, uint64_t amount)
("rctl_enforce: unknown action %d",
rule->rr_action));
/*
* We're supposed to send a signal, but the process
* is not fully initialized yet, probably because we
* got called from fork1(). For now just deny the
* allocation instead.
*/
if (p->p_state != PRS_NORMAL) {
should_deny = 1;
continue;
}
/*
* We're using the fact that RCTL_ACTION_SIG* values
* are equal to their counterparts from sys/signal.h.