PERFORCE change 188283 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Jan 28 21:04:16 UTC 2011


http://p4web.freebsd.org/@@188283?ac=10

Change 188283 by trasz at trasz_victim on 2011/01/28 21:03:18

	Prevent one from adding per-process limits for processes marked
	as P_SYSTEM, or retrieving resource usage information for these
	processes.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#23 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#23 (text+ko) ====

@@ -935,6 +935,16 @@
 	    rusage_is_sloppy(rule->rr_resource))
 		return (EINVAL);
 
+	if (rule->rr_subject_type == RCTL_SUBJECT_TYPE_PROCESS) {
+		p = rule->rr_subject.rs_proc;
+		PROC_LOCK(p);
+		if (p->p_flag & P_SYSTEM) {
+			PROC_UNLOCK(p);
+			return (EINVAL);
+		}
+		PROC_UNLOCK(p);
+	}
+
 	/*
 	 * Make sure there are no duplicated rules.  Also, for the "deny"
 	 * rules, remove ones differing only by "amount".
@@ -1223,6 +1233,13 @@
 			error = EINVAL;
 			goto out;
 		}
+		PROC_LOCK(p);
+		if (p->p_flag & P_SYSTEM) {
+			PROC_UNLOCK(p);
+			error = EINVAL;
+			goto out;
+		}
+		PROC_UNLOCK(p);
 		outputsbuf = rctl_container_to_sbuf(p->p_container, 0);
 		break;
 	case RCTL_SUBJECT_TYPE_USER:


More information about the p4-projects mailing list