summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_rctl.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2011-09-06 17:22:40 +0000
committertrasz <trasz@FreeBSD.org>2011-09-06 17:22:40 +0000
commita8bcc12be3853383f7ec1153f3e0a29c036b9414 (patch)
treea3037d4fce7bdc5a53f08874370b1d4717b78611 /sys/kern/kern_rctl.c
parentb9fc62c9ff051ba3a5468a058c2c8577ed91b506 (diff)
downloadFreeBSD-src-a8bcc12be3853383f7ec1153f3e0a29c036b9414.zip
FreeBSD-src-a8bcc12be3853383f7ec1153f3e0a29c036b9414.tar.gz
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)
Diffstat (limited to 'sys/kern/kern_rctl.c')
-rw-r--r--sys/kern/kern_rctl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c
index bf445f6..a8a463f 100644
--- a/sys/kern/kern_rctl.c
+++ b/sys/kern/kern_rctl.c
@@ -363,6 +363,17 @@ rctl_enforce(struct proc *p, int resource, uint64_t amount)
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.
*/
OpenPOWER on IntegriCloud