Date: Fri, 28 Jan 2011 21:04:15 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 188283 for review Message-ID: <201101282104.p0SL4FJI015044@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@188283?ac=10 Change 188283 by trasz@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101282104.p0SL4FJI015044>
