summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_rctl.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2012-04-17 14:31:02 +0000
committertrasz <trasz@FreeBSD.org>2012-04-17 14:31:02 +0000
commit29ba0a35f6797ce4bf491112e3cf87135d7699fa (patch)
tree4f48cd880982ffd18aedf55994073cafdde2ea5c /sys/kern/kern_rctl.c
parenta41bb18a2972ad4367c7880992b63b7e4b3df8ee (diff)
downloadFreeBSD-src-29ba0a35f6797ce4bf491112e3cf87135d7699fa.zip
FreeBSD-src-29ba0a35f6797ce4bf491112e3cf87135d7699fa.tar.gz
Stop treating system processes as special. This fixes panics
like the one triggered by this: # kldload geom_vinum # pwait `pgrep -S gv_worker` & # kldunload geom_vinum or this: GEOM_JOURNAL: Shutting down geom gjournal 3464572051. panic: destroying non-empty racct: 1 allocated for resource 6 which were tracked by jh@ to be caused by checking p->p_flag, while it wasn't initialised yet. Basically, during fork, the code checked p_flag, concluded the process isn't marked as P_SYSTEM, incremented the counter, and later on, when exiting, checked that the process was marked as P_SYSTEM, and thus didn't decrement it. Also, I believe there wasn't any good reason for checking P_SYSTEM in the first place. Tested by: jh
Diffstat (limited to 'sys/kern/kern_rctl.c')
-rw-r--r--sys/kern/kern_rctl.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c
index 883fa30..1d0a440 100644
--- a/sys/kern/kern_rctl.c
+++ b/sys/kern/kern_rctl.c
@@ -994,11 +994,6 @@ rctl_rule_add(struct rctl_rule *rule)
case RCTL_SUBJECT_TYPE_PROCESS:
p = rule->rr_subject.rs_proc;
KASSERT(p != NULL, ("rctl_rule_add: NULL proc"));
- /*
- * No resource limits for system processes.
- */
- if (p->p_flag & P_SYSTEM)
- return (EPERM);
rctl_racct_add_rule(p->p_racct, rule);
/*
@@ -1036,8 +1031,6 @@ rctl_rule_add(struct rctl_rule *rule)
*/
sx_assert(&allproc_lock, SA_LOCKED);
FOREACH_PROC_IN_SYSTEM(p) {
- if (p->p_flag & P_SYSTEM)
- continue;
cred = p->p_ucred;
switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_USER:
@@ -1284,10 +1277,6 @@ sys_rctl_get_racct(struct thread *td, struct rctl_get_racct_args *uap)
error = EINVAL;
goto out;
}
- if (p->p_flag & P_SYSTEM) {
- error = EINVAL;
- goto out;
- }
outputsbuf = rctl_racct_to_sbuf(p->p_racct, 0);
break;
case RCTL_SUBJECT_TYPE_USER:
@@ -1719,20 +1708,7 @@ rctl_proc_fork(struct proc *parent, struct proc *child)
LIST_INIT(&child->p_racct->r_rule_links);
- /*
- * No limits for kernel processes.
- */
- if (child->p_flag & P_SYSTEM)
- return (0);
-
- /*
- * Nothing to inherit from P_SYSTEM parents.
- */
- if (parent->p_racct == NULL) {
- KASSERT(parent->p_flag & P_SYSTEM,
- ("non-system process without racct; p = %p", parent));
- return (0);
- }
+ KASSERT(parent->p_racct != NULL, ("process without racct; p = %p", parent));
rw_wlock(&rctl_lock);
OpenPOWER on IntegriCloud