From owner-p4-projects@FreeBSD.ORG Fri Jan 28 21:04:16 2011 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5CF1D1065670; Fri, 28 Jan 2011 21:04:16 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F78C106564A for ; Fri, 28 Jan 2011 21:04:16 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 0D67E8FC0A for ; Fri, 28 Jan 2011 21:04:16 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id p0SL4F7a015047 for ; Fri, 28 Jan 2011 21:04:15 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id p0SL4FJI015044 for perforce@freebsd.org; Fri, 28 Jan 2011 21:04:15 GMT (envelope-from trasz@freebsd.org) Date: Fri, 28 Jan 2011 21:04:15 GMT Message-Id: <201101282104.p0SL4FJI015044@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 188283 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2011 21:04:16 -0000 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: