Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Aug 2002 18:27:43 -0400 (EDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Brian Feldman <green@FreeBSD.org>
Cc:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   Re: PERFORCE change 15878 for review
Message-ID:  <Pine.NEB.3.96L.1020812182227.68699A-100000@fledge.watson.org>
In-Reply-To: <200208122052.g7CKq3Mw002958@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Mon, 12 Aug 2002, Brian Feldman wrote:

> +void
> +sebsd(KINFO *k, VARENT *ve)
> +{
> +	char buf[128];
> +	struct mac_pid_data mpd;
> +	size_t datalen;
> +	VAR *v;
> +
> +	strcpy(buf, "<<whoknows>>");
> +	strcpy(mpd.mpd_name, "trustedbsd_sebsd");
> +	mpd.mpd_data = buf;
> +	datalen = sizeof(buf);
> +	mpd.mpd_datalen = &datalen;
> +	(void)mac_get_pid(k->ki_p->ki_pid, &mpd, 1);
> +	v = ve->var;
> +	(void)printf("%*s", v->width, mpd.mpd_data);
> +}

This looks like it will do distinctly the wrong thing when applied to a
core dump.  You probably need to provide a way to disable printing of
sebsd information when ps is running on a core rather than a live kernel,
or you get the labels from the live kernel processes instead of the core.

> -static void	mac_cred_mmapped_drop_perms(struct thread *td,
> +void	mac_cred_mmapped_drop_perms(struct thread *td,
>  		    struct ucred *cred);

This seems like a somewhat gratuitous change and is clearly unrelated to
your commit message :-).

>  static void	mac_cred_mmapped_drop_perms_recurse(struct thread *td,
>  		    struct ucred *cred, struct vm_map *map);
> @@ -474,6 +474,10 @@
>  			mpc->mpc_ops->mpo_externalize =
>  			    mpe->mpe_function;
>  			break;
> +		case MAC_EXTERNALIZE_PID:
> +			mpc->mpc_ops->mpo_externalize_pid =
> +			    mpe->mpe_function;
> +			break;
>  		case MAC_INTERNALIZE:
>  			mpc->mpc_ops->mpo_internalize =
>  			    mpe->mpe_function;
> @@ -2062,7 +2066,7 @@
>   * memory space, and revoke access (in the least surprising ways we
>   * know) when necessary.  The process lock is not held here.
>   */
> -static void
> +void
>  mac_cred_mmapped_drop_perms(struct thread *td, struct ucred *cred)
>  {
>  
> @@ -2899,6 +2903,55 @@
>  	return (error);
>  }
>  
> +#if 0
> +395     MSTD    BSD     { int __mac_get_pid(pid_t pid,
> +                                struct mac_pid_data *mpd, size_t mpdcnt) };
> +#endif

Don't put unparsable code in #if's, it breaks indent and other C parsing
and analysis tools (such as lint).  If you must put this information in,
use a comment.

> +int
> +mac_get_pid(struct thread *td, struct mac_get_pid_args *uap)

Once we get the new user<->kernel labeling API in, hopefully we can move
to using that here.  It will presumably look similar but be gratuitously
different :-).

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1020812182227.68699A-100000>