From owner-p4-projects Thu Aug 1 19:18:15 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E628737B401; Thu, 1 Aug 2002 19:18:09 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3DE1B37B400; Thu, 1 Aug 2002 19:18:09 -0700 (PDT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4A36B43E3B; Thu, 1 Aug 2002 19:18:08 -0700 (PDT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.12.4/8.12.4) with SMTP id g722HsOo093392; Thu, 1 Aug 2002 22:17:54 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Thu, 1 Aug 2002 22:17:54 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Chris Vance Cc: Perforce Change Reviews Subject: Re: PERFORCE change 15425 for review In-Reply-To: <200208020105.g72154i9089777@freefall.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 1 Aug 2002, Chris Vance wrote: > http://people.freebsd.org/~peter/p4db/chv.cgi?CH=15425 > > Change 15425 by cvance@cvance_laptop on 2002/08/01 18:04:47 > > Add support for a basic mac_policy syscall handler. > Things to think about: > - who guarantees MPSAFE, trustedbsd harness or the modules? Right now, modules are assumed to be MPSAFE, although they can grab Giant if they need it. > - the module must perform the copyin on the arg parameter. Probably unavoidable > + case MAC_SYSCALL: > + mpc->mpc_ops->mpo_mac_policy = > + mpe->mpe_function; Looks like you're missing a "break;" here. Should we rename mac_policy() to mac_syscall()? > case MAC_DESTROY: > mpc->mpc_ops->mpo_destroy = > mpe->mpe_function; > @@ -3060,6 +3063,40 @@ > return (error); > } > > +/* > + * MPSAFE > + */ > +int > +mac_policy(struct thread *td, struct mac_policy_args *uap) > +{ > + int error; > + char target[128]; /* TBD: should be MAX_MAXNAME or some such */ We probably should define a MAC_POLICY_MAXNAME or something and use that, as well as bound the policy name provided by the policy to that length during registration. > + error = copyinstr(uap->policy, target, sizeof(target), NULL); > + if (error == ENAMETOOLONG) { > + return (EINVAL); > + } I would imagine it's OK to return the error verbatim..? > + LIST_FOREACH(mpc, &mac_policy_list, mpc_list) { > + if (strcmp(mpc->mpc_name, target) == 0 && > + mpc->mpc_ops->mpo_mac_policy) { > + error = mpc->mpc_ops->mpo_mac_policy(SCARG(uap, call), > + SCARG(uap, arg)); > + goto out; Looks good, thanks! Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Network Associates Laboratories To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message