From owner-freebsd-arch Mon Sep 4 10:18:24 2000 Delivered-To: freebsd-arch@freebsd.org Received: from gatekeeper.tsc.tdk.com (gatekeeper.tsc.tdk.com [207.113.159.21]) by hub.freebsd.org (Postfix) with ESMTP id E5A4837B422; Mon, 4 Sep 2000 10:18:21 -0700 (PDT) Received: from imap.gv.tsc.tdk.com (imap.gv.tsc.tdk.com [192.168.241.198]) by gatekeeper.tsc.tdk.com (8.8.8/8.8.8) with ESMTP id KAA05221; Mon, 4 Sep 2000 10:18:21 -0700 (PDT) (envelope-from gdonl@tsc.tdk.com) Received: from salsa.gv.tsc.tdk.com (salsa.gv.tsc.tdk.com [192.168.241.194]) by imap.gv.tsc.tdk.com (8.9.3/8.9.3) with ESMTP id KAA13781; Mon, 4 Sep 2000 10:18:21 -0700 (PDT) (envelope-from Don.Lewis@tsc.tdk.com) Received: (from gdonl@localhost) by salsa.gv.tsc.tdk.com (8.8.5/8.8.5) id KAA21836; Mon, 4 Sep 2000 10:18:20 -0700 (PDT) From: Don Lewis Message-Id: <200009041718.KAA21836@salsa.gv.tsc.tdk.com> Date: Mon, 4 Sep 2000 10:18:20 -0700 In-Reply-To: References: X-Mailer: Mail User's Shell (7.2.6 beta(5) 10/07/98) To: Robert Watson , Don Lewis Subject: Re: Request for review: restructuring of per-uid resource limits Cc: freebsd-arch@FreeBSD.ORG Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sep 3, 7:18pm, Robert Watson wrote: } Subject: Re: Request for review: restructuring of per-uid resource limits } } Just a comment, haven't had a chance to review your e-mail yet -- per-uid } resources currently function poorly in combination with jail(). A bit } more uniquifying information may need to be used to determine the } resource/accounting pool than uid in some FreeBSD environments. A patch } was submitted a while back to do this, but it wasn't ever integrated due } to lack of time from phk and myself. Probably the appropriate way to } handle this is to add some sort of abstraction for determining the correct } resource pool, allowing future partioning/namespace schemes to be } implemented easily. I.e., } } struct resourcepool *res; } res = getresourcepool(p); } if (res == NULL) } return; /* no resource limitations */ } } Possibly, a cred argument to the getresourcepool() function, if we feel } that resources will likely be handled on the basis of credentials rather } than processes. Given the future directions for MAC and so on, that might } make a lot of sense also. It would probably be easier to invert this and add a pointer to the resource pool to the credential (and p_prison should probably be moved to ucred). Trying to figure out anything from proc doesn't work too well in the case of things like sbsize, since sockets may stick around a lot longer than the processes that created them. Sockets do hang on to a reference to the credential. My modifications to the API should make this easier to implement, since the credential is passed at the higher levels instead of the uid. I think most of the changes needed would be limited to the callers of uifind() and friends (mostly in kern_prot.c and kern_resource.c). One current bit of uglyness is the pcred/ucred split and how we use the uid fields in both. If you throw jail() into the mix, it will probably get worse, since some resources might be limited on per-jail basis, some on a per-uid basis, and some on a per-uid in the jail basis, possibly with a limit on the total per-jail in the last case. Now that I think about it, this probably means we'll want to implement a separate hash table for each resource, rather than a single table that tracks multiple resources for a given key. I'd like to get my patch tested and into the tree sooner rather than later, since I'm concerned about bugs in the existing implementation. I also want something that can be MFC'ed to 4-stable. Speaking of my patch, I did some of the cleanup that I mentioned in my previous message, and also fixed an interaction with NFS that caused a panic. My new patch is at . To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message