PERFORCE change 100642 for review

Robert Watson rwatson at FreeBSD.org
Wed Jul 5 17:16:26 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=100642

Change 100642 by rwatson at rwatson_zoo on 2006/07/05 17:16:17

	Start resort of entry points by object type.  No renaming yet.

Affected files ...

.. //depot/projects/trustedbsd/mac2/sys/sys/mac_policy.h#3 edit

Differences ...

==== //depot/projects/trustedbsd/mac2/sys/sys/mac_policy.h#3 (text+ko) ====

@@ -72,6 +72,9 @@
  *   inpcb > socket > mbuf
  *   bpfdesc > ifnet > mbuf
  *   * > cred
+ *
+ * It may be desirable also to consider some subsystems as "objects", such
+ * as system, netinet, etc.
  */
 struct acl;
 struct bpf_d;
@@ -104,6 +107,11 @@
 
 /*
  * Policy module operations.
+ *
+ * XXXRW: There should probably be separate init/attach/detach/destroy
+ * operations so that policies can perform sleeping memory allocation before
+ * attaching, which occurs with locks held.  We might also want to allow
+ * attach to fail.
  */
 typedef void	(*mpo_destroy_t)(struct mac_policy_conf *mpc);
 typedef void	(*mpo_init_t)(struct mac_policy_conf *mpc);
@@ -121,103 +129,28 @@
 typedef void	(*mpo_placeholder_t)(void);
 
 /*
- * Label operations.  Initialize label storage, destroy label
- * storage, recycle for re-use without init/destroy, copy a label to
- * initialized storage, and externalize/internalize from/to
- * initialized storage.
+ * Object: struct bpfdesc (BPF descriptor)
  */
 typedef void	(*mpo_init_bpfdesc_label_t)(struct label *label);
-typedef void	(*mpo_init_cred_label_t)(struct label *label);
-typedef void	(*mpo_init_devfsdirent_label_t)(struct label *label);
-typedef void	(*mpo_init_ifnet_label_t)(struct label *label);
-typedef int	(*mpo_init_inpcb_label_t)(struct label *label, int flag);
-typedef void	(*mpo_init_sysv_msgmsg_label_t)(struct label *label);
-typedef void	(*mpo_init_sysv_msgqueue_label_t)(struct label *label);
-typedef void	(*mpo_init_sysv_sem_label_t)(struct label *label);
-typedef void	(*mpo_init_sysv_shm_label_t)(struct label *label);
-typedef int	(*mpo_init_ipq_label_t)(struct label *label, int flag);
-typedef int	(*mpo_init_mbuf_label_t)(struct label *label, int flag);
-typedef void	(*mpo_init_mount_label_t)(struct label *label);
-typedef void	(*mpo_init_mount_fs_label_t)(struct label *label);
-typedef int	(*mpo_init_socket_label_t)(struct label *label, int flag);
-typedef int	(*mpo_init_socket_peer_label_t)(struct label *label,
-		    int flag);
-typedef void	(*mpo_init_pipe_label_t)(struct label *label);
-typedef void    (*mpo_init_posix_sem_label_t)(struct label *label);
-typedef void	(*mpo_init_proc_label_t)(struct label *label);
-typedef void	(*mpo_init_vnode_label_t)(struct label *label);
 typedef void	(*mpo_destroy_bpfdesc_label_t)(struct label *label);
-typedef void	(*mpo_destroy_cred_label_t)(struct label *label);
-typedef void	(*mpo_destroy_devfsdirent_label_t)(struct label *label);
-typedef void	(*mpo_destroy_ifnet_label_t)(struct label *label);
-typedef void	(*mpo_destroy_inpcb_label_t)(struct label *label);
-typedef void	(*mpo_destroy_sysv_msgmsg_label_t)(struct label *label);
-typedef void	(*mpo_destroy_sysv_msgqueue_label_t)(struct label *label);
-typedef void	(*mpo_destroy_sysv_sem_label_t)(struct label *label);
-typedef void	(*mpo_destroy_sysv_shm_label_t)(struct label *label);
-typedef void	(*mpo_destroy_ipq_label_t)(struct label *label);
-typedef void	(*mpo_destroy_mbuf_label_t)(struct label *label);
-typedef void	(*mpo_destroy_mount_label_t)(struct label *label);
-typedef void	(*mpo_destroy_mount_fs_label_t)(struct label *label);
-typedef void	(*mpo_destroy_socket_label_t)(struct label *label);
-typedef void	(*mpo_destroy_socket_peer_label_t)(struct label *label);
-typedef void	(*mpo_destroy_pipe_label_t)(struct label *label);
-typedef void    (*mpo_destroy_posix_sem_label_t)(struct label *label);
-typedef void	(*mpo_destroy_proc_label_t)(struct label *label);
-typedef void	(*mpo_destroy_vnode_label_t)(struct label *label);
-typedef void	(*mpo_cleanup_sysv_msgmsg_t)(struct label *msglabel);
-typedef void	(*mpo_cleanup_sysv_msgqueue_t)(struct label *msqlabel);
-typedef void	(*mpo_cleanup_sysv_sem_t)(struct label *semalabel);
-typedef void	(*mpo_cleanup_sysv_shm_t)(struct label *shmlabel);
-typedef void	(*mpo_copy_cred_label_t)(struct label *src,
-		    struct label *dest);
-typedef void	(*mpo_copy_ifnet_label_t)(struct label *src,
-		    struct label *dest);
-typedef void	(*mpo_copy_mbuf_label_t)(struct label *src,
-		    struct label *dest);
-typedef void	(*mpo_copy_pipe_label_t)(struct label *src,
-		    struct label *dest);
-typedef void	(*mpo_copy_socket_label_t)(struct label *src,
-		    struct label *dest);
-typedef void	(*mpo_copy_vnode_label_t)(struct label *src,
-		    struct label *dest);
-typedef int	(*mpo_externalize_cred_label_t)(struct label *label,
-		    char *element_name, struct sbuf *sb, int *claimed);
-typedef int	(*mpo_externalize_ifnet_label_t)(struct label *label,
-		    char *element_name, struct sbuf *sb, int *claimed);
-typedef int	(*mpo_externalize_pipe_label_t)(struct label *label,
-		    char *element_name, struct sbuf *sb, int *claimed);
-typedef int	(*mpo_externalize_socket_label_t)(struct label *label,
-		    char *element_name, struct sbuf *sb, int *claimed);
-typedef int	(*mpo_externalize_socket_peer_label_t)(struct label *label,
-		    char *element_name, struct sbuf *sb, int *claimed);
-typedef int	(*mpo_externalize_vnode_label_t)(struct label *label,
-		    char *element_name, struct sbuf *sb, int *claimed);
-typedef int	(*mpo_internalize_cred_label_t)(struct label *label,
-		    char *element_name, char *element_data, int *claimed);
-typedef int	(*mpo_internalize_ifnet_label_t)(struct label *label,
-		    char *element_name, char *element_data, int *claimed);
-typedef int	(*mpo_internalize_pipe_label_t)(struct label *label,
-		    char *element_name, char *element_data, int *claimed);
-typedef int	(*mpo_internalize_socket_label_t)(struct label *label,
-		    char *element_name, char *element_data, int *claimed);
-typedef int	(*mpo_internalize_vnode_label_t)(struct label *label,
-		    char *element_name, char *element_data, int *claimed);
+typedef void	(*mpo_create_bpfdesc_t)(struct ucred *cred,
+		    struct bpf_d *bpf_d, struct label *bpflabel);
+typedef void	(*mpo_create_mbuf_from_bpfdesc_t)(struct bpf_d *bpf_d,
+		    struct label *bpflabel, struct mbuf *mbuf,
+		    struct label *mbuflabel);
+typedef	int	(*mpo_check_bpfdesc_receive_t)(struct bpf_d *bpf_d,
+		    struct label *bpflabel, struct ifnet *ifnet,
+		    struct label *ifnetlabel);
 
 /*
- * Labeling event operations: file system objects, and things that
- * look a lot like file system objects.
+ * Object: struct devfsdirent (Devfs directory entry)
  */
+typedef void	(*mpo_init_devfsdirent_label_t)(struct label *label);
+typedef void	(*mpo_destroy_devfsdirent_label_t)(struct label *label);
 typedef void	(*mpo_associate_vnode_devfs_t)(struct mount *mp,
 		    struct label *fslabel, struct devfs_dirent *de,
 		    struct label *delabel, struct vnode *vp,
 		    struct label *vlabel);
-typedef int	(*mpo_associate_vnode_extattr_t)(struct mount *mp,
-		    struct label *fslabel, struct vnode *vp,
-		    struct label *vlabel);
-typedef void	(*mpo_associate_vnode_singlelabel_t)(struct mount *mp,
-		    struct label *fslabel, struct vnode *vp,
-		    struct label *vlabel);
 typedef void	(*mpo_create_devfs_device_t)(struct ucred *cred,
 		    struct mount *mp, struct cdev *dev,
 		    struct devfs_dirent *de, struct label *label);
@@ -228,157 +161,181 @@
 		    struct mount *mp, struct devfs_dirent *dd,
 		    struct label *ddlabel, struct devfs_dirent *de,
 		    struct label *delabel);
-typedef int	(*mpo_create_vnode_extattr_t)(struct ucred *cred,
-		    struct mount *mp, struct label *fslabel,
-		    struct vnode *dvp, struct label *dlabel,
-		    struct vnode *vp, struct label *vlabel,
-		    struct componentname *cnp);
-typedef void	(*mpo_create_mount_t)(struct ucred *cred, struct mount *mp,
-		    struct label *mntlabel, struct label *fslabel);
-typedef void	(*mpo_relabel_vnode_t)(struct ucred *cred, struct vnode *vp,
-		    struct label *vnodelabel, struct label *label);
-typedef int	(*mpo_setlabel_vnode_extattr_t)(struct ucred *cred,
-		    struct vnode *vp, struct label *vlabel,
-		    struct label *intlabel);
 typedef void	(*mpo_update_devfsdirent_t)(struct mount *mp,
 		    struct devfs_dirent *devfs_dirent,
 		    struct label *direntlabel, struct vnode *vp,
 		    struct label *vnodelabel);
 
 /*
- * Labeling event operations: IPC objects.
+ * Object: struct ucred (User credential)
  */
-typedef void	(*mpo_create_mbuf_from_socket_t)(struct socket *so,
-		    struct label *socketlabel, struct mbuf *m,
-		    struct label *mbuflabel);
-typedef void	(*mpo_create_socket_t)(struct ucred *cred, struct socket *so,
-		    struct label *socketlabel);
-typedef void	(*mpo_create_socket_from_socket_t)(struct socket *oldsocket,
-		    struct label *oldsocketlabel, struct socket *newsocket,
-		    struct label *newsocketlabel);
-typedef void	(*mpo_relabel_socket_t)(struct ucred *cred, struct socket *so,
-		    struct label *oldlabel, struct label *newlabel);
-typedef void	(*mpo_relabel_pipe_t)(struct ucred *cred, struct pipepair *pp,
-		    struct label *oldlabel, struct label *newlabel);
-typedef void	(*mpo_set_socket_peer_from_mbuf_t)(struct mbuf *mbuf,
-		    struct label *mbuflabel, struct socket *so,
-		    struct label *socketpeerlabel);
-typedef void	(*mpo_set_socket_peer_from_socket_t)(struct socket *oldsocket,
-		    struct label *oldsocketlabel, struct socket *newsocket,
-		    struct label *newsocketpeerlabel);
-typedef void	(*mpo_create_pipe_t)(struct ucred *cred, struct pipepair *pp,
-		    struct label *pipelabel);
+typedef void	(*mpo_init_cred_label_t)(struct label *label);
+typedef void	(*mpo_destroy_cred_label_t)(struct label *label);
+typedef void	(*mpo_copy_cred_label_t)(struct label *src,
+		    struct label *dest);
+typedef int	(*mpo_externalize_cred_label_t)(struct label *label,
+		    char *element_name, struct sbuf *sb, int *claimed);
+typedef int	(*mpo_internalize_cred_label_t)(struct label *label,
+		    char *element_name, char *element_data, int *claimed);
+typedef void	(*mpo_relabel_cred_t)(struct ucred *cred,
+		    struct label *newlabel);
+typedef int	(*mpo_check_cred_relabel_t)(struct ucred *cred,
+		    struct label *newlabel);
+typedef int	(*mpo_check_cred_visible_t)(struct ucred *u1,
+		    struct ucred *u2);
 
 /*
- * Labeling event operations: System V IPC primitives.
+ * Object: struct ifnet (Network interface)
  */
-typedef void	(*mpo_create_sysv_msgmsg_t)(struct ucred *cred,
-		    struct msqid_kernel *msqkptr, struct label *msqlabel,
-		    struct msg *msgptr, struct label *msglabel);
-typedef void	(*mpo_create_sysv_msgqueue_t)(struct ucred *cred,
-		    struct msqid_kernel *msqkptr, struct label *msqlabel);
-typedef void	(*mpo_create_sysv_sem_t)(struct ucred *cred,
-		    struct semid_kernel *semakptr, struct label *semalabel);
-typedef void	(*mpo_create_sysv_shm_t)(struct ucred *cred,
-		    struct shmid_kernel *shmsegptr, struct label *shmlabel);
+typedef void	(*mpo_init_ifnet_label_t)(struct label *label);
+typedef void	(*mpo_destroy_ifnet_label_t)(struct label *label);
+typedef void	(*mpo_copy_ifnet_label_t)(struct label *src,
+		    struct label *dest);
+typedef int	(*mpo_externalize_ifnet_label_t)(struct label *label,
+		    char *element_name, struct sbuf *sb, int *claimed);
+typedef int	(*mpo_internalize_ifnet_label_t)(struct label *label,
+		    char *element_name, char *element_data, int *claimed);
+typedef void	(*mpo_create_ifnet_t)(struct ifnet *ifnet,
+		    struct label *ifnetlabel);
+typedef void	(*mpo_create_mbuf_linklayer_t)(struct ifnet *ifnet,
+		    struct label *ifnetlabel, struct mbuf *mbuf,
+		    struct label *mbuflabel);
+typedef void	(*mpo_create_mbuf_from_ifnet_t)(struct ifnet *ifnet,
+		    struct label *ifnetlabel, struct mbuf *mbuf,
+		    struct label *mbuflabel);
+typedef void	(*mpo_create_mbuf_multicast_encap_t)(struct mbuf *oldmbuf,
+		    struct label *oldmbuflabel, struct ifnet *ifnet,
+		    struct label *ifnetlabel, struct mbuf *newmbuf,
+		    struct label *newmbuflabel);
+typedef void	(*mpo_relabel_ifnet_t)(struct ucred *cred,
+		    struct ifnet *ifnet, struct label *ifnetlabel,
+		    struct label *newlabel);
+typedef int	(*mpo_check_ifnet_relabel_t)(struct ucred *cred,
+		    struct ifnet *ifnet, struct label *ifnetlabel,
+		    struct label *newlabel);
+typedef int	(*mpo_check_ifnet_transmit_t)(struct ifnet *ifnet,
+		    struct label *ifnetlabel, struct mbuf *m,
+		    struct label *mbuflabel);
 
 /*
- * Labeling event operations: POSIX (global/inter-process) semaphores.
+ * Object: struct inpcb (Internet protocol control block)
  */
-typedef void	(*mpo_create_posix_sem_t)(struct ucred *cred,
-		    struct ksem *ksemptr, struct label *ks_label);
+typedef int	(*mpo_init_inpcb_label_t)(struct label *label, int flag);
+typedef void	(*mpo_destroy_inpcb_label_t)(struct label *label);
+typedef void	(*mpo_create_inpcb_from_socket_t)(struct socket *so,
+		    struct label *solabel, struct inpcb *inp,
+		    struct label *inplabel);
+typedef void	(*mpo_create_mbuf_from_inpcb_t)(struct inpcb *inp,
+		    struct label *inplabel, struct mbuf *m,
+		    struct label *mlabel);
+typedef void	(*mpo_inpcb_sosetlabel_t)(struct socket *so,
+		    struct label *label, struct inpcb *inp,
+		    struct label *inplabel);
+typedef int	(*mpo_check_inpcb_deliver_t)(struct inpcb *inp,
+		    struct label *inplabel, struct mbuf *m,
+		    struct label *mlabel);
 
 /*
- * Labeling event operations: network objects.
+ * Object: struct ipq (IP fragment reassembly queue)
  */
-typedef void	(*mpo_create_bpfdesc_t)(struct ucred *cred,
-		    struct bpf_d *bpf_d, struct label *bpflabel);
-typedef void	(*mpo_create_ifnet_t)(struct ifnet *ifnet,
-		    struct label *ifnetlabel);
-typedef void	(*mpo_create_inpcb_from_socket_t)(struct socket *so,
-		    struct label *solabel, struct inpcb *inp,
-		    struct label *inplabel);
+typedef int	(*mpo_init_ipq_label_t)(struct label *label, int flag);
+typedef void	(*mpo_destroy_ipq_label_t)(struct label *label);
 typedef void	(*mpo_create_ipq_t)(struct mbuf *fragment,
 		    struct label *fragmentlabel, struct ipq *ipq,
 		    struct label *ipqlabel);
 typedef void	(*mpo_create_datagram_from_ipq)
 		    (struct ipq *ipq, struct label *ipqlabel,
 		    struct mbuf *datagram, struct label *datagramlabel);
+typedef int	(*mpo_fragment_match_t)(struct mbuf *fragment,
+		    struct label *fragmentlabel, struct ipq *ipq,
+		    struct label *ipqlabel);
+typedef void	(*mpo_update_ipq_t)(struct mbuf *fragment,
+		    struct label *fragmentlabel, struct ipq *ipq,
+		    struct label *ipqlabel);
+
+/*
+ * Object: kenv (Kernel environment)
+ */
+typedef int	(*mpo_check_kenv_dump_t)(struct ucred *cred);
+typedef int	(*mpo_check_kenv_get_t)(struct ucred *cred, char *name);
+typedef int	(*mpo_check_kenv_set_t)(struct ucred *cred, char *name,
+		    char *value);
+typedef int	(*mpo_check_kenv_unset_t)(struct ucred *cred, char *name);
+
+/*
+ * Object: kld (Loadable kernel module)
+ */
+typedef int	(*mpo_check_kld_load_t)(struct ucred *cred, struct vnode *vp,
+		    struct label *vlabel);
+typedef int	(*mpo_check_kld_stat_t)(struct ucred *cred);
+typedef int	(*mpo_check_kld_unload_t)(struct ucred *cred);
+
+/*
+ * Object: struct ksem (POSIX semaphore)
+ */
+typedef void    (*mpo_init_posix_sem_label_t)(struct label *label);
+typedef void    (*mpo_destroy_posix_sem_label_t)(struct label *label);
+typedef void	(*mpo_create_posix_sem_t)(struct ucred *cred,
+		    struct ksem *ksemptr, struct label *ks_label);
+typedef int	(*mpo_check_posix_sem_destroy_t)(struct ucred *cred,
+		    struct ksem *ksemptr, struct label *ks_label);
+typedef int	(*mpo_check_posix_sem_getvalue_t)(struct ucred *cred,
+		    struct ksem *ksemptr, struct label *ks_label);
+typedef int	(*mpo_check_posix_sem_open_t)(struct ucred *cred,
+		    struct ksem *ksemptr, struct label *ks_label);
+typedef int	(*mpo_check_posix_sem_post_t)(struct ucred *cred,
+		    struct ksem *ksemptr, struct label *ks_label);
+typedef int	(*mpo_check_posix_sem_unlink_t)(struct ucred *cred,
+		    struct ksem *ksemptr, struct label *ks_label);
+typedef int	(*mpo_check_posix_sem_wait_t)(struct ucred *cred,
+		    struct ksem *ksemptr, struct label *ks_label);
+
+/*
+ * Object: struct mbuf (Message buffer)
+ */
+typedef int	(*mpo_init_mbuf_label_t)(struct label *label, int flag);
+typedef void	(*mpo_destroy_mbuf_label_t)(struct label *label);
+typedef void	(*mpo_copy_mbuf_label_t)(struct label *src,
+		    struct label *dest);
+typedef void	(*mpo_create_mbuf_from_socket_t)(struct socket *so,
+		    struct label *socketlabel, struct mbuf *m,
+		    struct label *mbuflabel);
+typedef void	(*mpo_set_socket_peer_from_mbuf_t)(struct mbuf *mbuf,
+		    struct label *mbuflabel, struct socket *so,
+		    struct label *socketpeerlabel);
 typedef void	(*mpo_create_fragment_t)(struct mbuf *datagram,
 		    struct label *datagramlabel, struct mbuf *fragment,
 		    struct label *fragmentlabel);
-typedef void	(*mpo_create_mbuf_from_inpcb_t)(struct inpcb *inp,
-		    struct label *inplabel, struct mbuf *m,
-		    struct label *mlabel);
-typedef void	(*mpo_create_mbuf_linklayer_t)(struct ifnet *ifnet,
-		    struct label *ifnetlabel, struct mbuf *mbuf,
-		    struct label *mbuflabel);
-typedef void	(*mpo_create_mbuf_from_bpfdesc_t)(struct bpf_d *bpf_d,
-		    struct label *bpflabel, struct mbuf *mbuf,
-		    struct label *mbuflabel);
-typedef void	(*mpo_create_mbuf_from_ifnet_t)(struct ifnet *ifnet,
-		    struct label *ifnetlabel, struct mbuf *mbuf,
-		    struct label *mbuflabel);
-typedef void	(*mpo_create_mbuf_multicast_encap_t)(struct mbuf *oldmbuf,
-		    struct label *oldmbuflabel, struct ifnet *ifnet,
-		    struct label *ifnetlabel, struct mbuf *newmbuf,
-		    struct label *newmbuflabel);
 typedef void	(*mpo_create_mbuf_netlayer_t)(struct mbuf *oldmbuf,
 		    struct label *oldmbuflabel, struct mbuf *newmbuf,
 		    struct label *newmbuflabel);
-typedef int	(*mpo_fragment_match_t)(struct mbuf *fragment,
-		    struct label *fragmentlabel, struct ipq *ipq,
-		    struct label *ipqlabel);
 typedef void	(*mpo_reflect_mbuf_icmp_t)(struct mbuf *m,
 		    struct label *mlabel);
 typedef void	(*mpo_reflect_mbuf_tcp_t)(struct mbuf *m,
 		    struct label *mlabel);
-typedef void	(*mpo_relabel_ifnet_t)(struct ucred *cred,
-		    struct ifnet *ifnet, struct label *ifnetlabel,
-		    struct label *newlabel);
-typedef void	(*mpo_update_ipq_t)(struct mbuf *fragment,
-		    struct label *fragmentlabel, struct ipq *ipq,
-		    struct label *ipqlabel);
-typedef void	(*mpo_inpcb_sosetlabel_t)(struct socket *so,
-		    struct label *label, struct inpcb *inp,
-		    struct label *inplabel);
 
 /*
- * Labeling event operations: processes.
+ * Object: struct mount (File system mountpoint)
  */
-typedef void	(*mpo_execve_transition_t)(struct ucred *old,
-		    struct ucred *new, struct vnode *vp,
-		    struct label *vnodelabel, struct label *interpvnodelabel,
-		    struct image_params *imgp, struct label *execlabel);
-typedef int	(*mpo_execve_will_transition_t)(struct ucred *old,
-		    struct vnode *vp, struct label *vnodelabel,
-		    struct label *interpvnodelabel,
-		    struct image_params *imgp, struct label *execlabel);
-typedef void	(*mpo_create_proc0_t)(struct ucred *cred);
-typedef void	(*mpo_create_proc1_t)(struct ucred *cred);
-typedef void	(*mpo_relabel_cred_t)(struct ucred *cred,
-		    struct label *newlabel);
-typedef void	(*mpo_thread_userret_t)(struct thread *thread);
+typedef void	(*mpo_init_mount_label_t)(struct label *label);
+typedef void	(*mpo_init_mount_fs_label_t)(struct label *label);
+typedef void	(*mpo_destroy_mount_label_t)(struct label *label);
+typedef void	(*mpo_destroy_mount_fs_label_t)(struct label *label);
+typedef int	(*mpo_check_mount_stat_t)(struct ucred *cred,
+		    struct mount *mp, struct label *mntlabel);
 
 /*
- * Access control checks.
+ * Object: struct msqid_kernel (System V message queue)
  */
-typedef	int	(*mpo_check_bpfdesc_receive_t)(struct bpf_d *bpf_d,
-		    struct label *bpflabel, struct ifnet *ifnet,
-		    struct label *ifnetlabel);
-typedef int	(*mpo_check_cred_relabel_t)(struct ucred *cred,
-		    struct label *newlabel);
-typedef int	(*mpo_check_cred_visible_t)(struct ucred *u1,
-		    struct ucred *u2);
-typedef int	(*mpo_check_ifnet_relabel_t)(struct ucred *cred,
-		    struct ifnet *ifnet, struct label *ifnetlabel,
-		    struct label *newlabel);
-typedef int	(*mpo_check_ifnet_transmit_t)(struct ifnet *ifnet,
-		    struct label *ifnetlabel, struct mbuf *m,
-		    struct label *mbuflabel);
-typedef int	(*mpo_check_inpcb_deliver_t)(struct inpcb *inp,
-		    struct label *inplabel, struct mbuf *m,
-		    struct label *mlabel);
+typedef void	(*mpo_init_sysv_msgqueue_label_t)(struct label *label);
+typedef void	(*mpo_destroy_sysv_msgqueue_label_t)(struct label *label);
+typedef void	(*mpo_cleanup_sysv_msgqueue_t)(struct label *msqlabel);
+typedef void	(*mpo_create_sysv_msgmsg_t)(struct ucred *cred,
+		    struct msqid_kernel *msqkptr, struct label *msqlabel,
+		    struct msg *msgptr, struct label *msglabel);
+typedef void	(*mpo_create_sysv_msgqueue_t)(struct ucred *cred,
+		    struct msqid_kernel *msqkptr, struct label *msqlabel);
+
 typedef int	(*mpo_check_sysv_msgmsq_t)(struct ucred *cred,
 		    struct msg *msgptr, struct label *msglabel,
 		    struct msqid_kernel *msqkptr, struct label *msqklabel);
@@ -395,40 +352,28 @@
 typedef int	(*mpo_check_sysv_msqctl_t)(struct ucred *cred,
 		    struct msqid_kernel *msqkptr, struct label *msqklabel,
 		    int cmd);
-typedef int	(*mpo_check_sysv_semctl_t)(struct ucred *cred,
-		    struct semid_kernel *semakptr, struct label *semaklabel,
-		    int cmd);
-typedef int	(*mpo_check_sysv_semget_t)(struct ucred *cred,
-		    struct semid_kernel *semakptr, struct label *semaklabel);
-typedef int	(*mpo_check_sysv_semop_t)(struct ucred *cred,
-		    struct semid_kernel *semakptr, struct label *semaklabel,
-		    size_t accesstype);
-typedef int	(*mpo_check_sysv_shmat_t)(struct ucred *cred,
-		    struct shmid_kernel *shmsegptr,
-		    struct label *shmseglabel, int shmflg);
-typedef int	(*mpo_check_sysv_shmctl_t)(struct ucred *cred,
-		    struct shmid_kernel *shmsegptr,
-		    struct label *shmseglabel, int cmd);
-typedef int	(*mpo_check_sysv_shmdt_t)(struct ucred *cred,
-		    struct shmid_kernel *shmsegptr,
-		    struct label *shmseglabel);
-typedef int	(*mpo_check_sysv_shmget_t)(struct ucred *cred,
-		    struct shmid_kernel *shmsegptr,
-		    struct label *shmseglabel, int shmflg);
-typedef int	(*mpo_check_kenv_dump_t)(struct ucred *cred);
-typedef int	(*mpo_check_kenv_get_t)(struct ucred *cred, char *name);
-typedef int	(*mpo_check_kenv_set_t)(struct ucred *cred, char *name,
-		    char *value);
-typedef int	(*mpo_check_kenv_unset_t)(struct ucred *cred, char *name);
-typedef int	(*mpo_check_kld_load_t)(struct ucred *cred, struct vnode *vp,
-		    struct label *vlabel);
-typedef int	(*mpo_check_kld_stat_t)(struct ucred *cred);
-typedef int	(*mpo_check_kld_unload_t)(struct ucred *cred);
-typedef int	(*mpo_mpo_placeholder19_t)(void);
-typedef int	(*mpo_mpo_placeholder20_t)(void);
-typedef int	(*mpo_check_mount_stat_t)(struct ucred *cred,
-		    struct mount *mp, struct label *mntlabel);
-typedef int	(*mpo_mpo_placeholder21_t)(void);
+/*
+ * Object: struct msg (System V message)
+ */
+typedef void	(*mpo_init_sysv_msgmsg_label_t)(struct label *label);
+typedef void	(*mpo_destroy_sysv_msgmsg_label_t)(struct label *label);
+typedef void	(*mpo_cleanup_sysv_msgmsg_t)(struct label *msglabel);
+
+/*
+ * Object: struct pipepair (Pipe)
+ */
+typedef void	(*mpo_init_pipe_label_t)(struct label *label);
+typedef void	(*mpo_destroy_pipe_label_t)(struct label *label);
+typedef void	(*mpo_copy_pipe_label_t)(struct label *src,
+		    struct label *dest);
+typedef int	(*mpo_externalize_pipe_label_t)(struct label *label,
+		    char *element_name, struct sbuf *sb, int *claimed);
+typedef int	(*mpo_internalize_pipe_label_t)(struct label *label,
+		    char *element_name, char *element_data, int *claimed);
+typedef void	(*mpo_relabel_pipe_t)(struct ucred *cred, struct pipepair *pp,
+		    struct label *oldlabel, struct label *newlabel);
+typedef void	(*mpo_create_pipe_t)(struct ucred *cred, struct pipepair *pp,
+		    struct label *pipelabel);
 typedef int	(*mpo_check_pipe_ioctl_t)(struct ucred *cred,
 		    struct pipepair *pp, struct label *pipelabel,
 		    unsigned long cmd, void *data);
@@ -443,18 +388,15 @@
 		    struct pipepair *pp, struct label *pipelabel);
 typedef int	(*mpo_check_pipe_write_t)(struct ucred *cred,
 		    struct pipepair *pp, struct label *pipelabel);
-typedef int	(*mpo_check_posix_sem_destroy_t)(struct ucred *cred,
-		    struct ksem *ksemptr, struct label *ks_label);
-typedef int	(*mpo_check_posix_sem_getvalue_t)(struct ucred *cred,
-		    struct ksem *ksemptr, struct label *ks_label);
-typedef int	(*mpo_check_posix_sem_open_t)(struct ucred *cred,
-		    struct ksem *ksemptr, struct label *ks_label);
-typedef int	(*mpo_check_posix_sem_post_t)(struct ucred *cred,
-		    struct ksem *ksemptr, struct label *ks_label);
-typedef int	(*mpo_check_posix_sem_unlink_t)(struct ucred *cred,
-		    struct ksem *ksemptr, struct label *ks_label);
-typedef int	(*mpo_check_posix_sem_wait_t)(struct ucred *cred,
-		    struct ksem *ksemptr, struct label *ks_label);
+
+/*
+ * Object: struct proc (Process)
+ */
+typedef void	(*mpo_init_proc_label_t)(struct label *label);
+typedef void	(*mpo_destroy_proc_label_t)(struct label *label);
+typedef void	(*mpo_create_proc0_t)(struct ucred *cred);
+typedef void	(*mpo_create_proc1_t)(struct ucred *cred);
+typedef void	(*mpo_thread_userret_t)(struct thread *thread);
 typedef int	(*mpo_check_proc_debug_t)(struct ucred *cred,
 		    struct proc *proc);
 typedef int	(*mpo_check_proc_sched_t)(struct ucred *cred,
@@ -477,6 +419,71 @@
 		    struct proc *proc, int signum);
 typedef int	(*mpo_check_proc_wait_t)(struct ucred *cred,
 		    struct proc *proc);
+
+/*
+ * Object: struct semid_kernel (System V IPC semaphore)
+ */
+typedef void	(*mpo_init_sysv_sem_label_t)(struct label *label);
+typedef void	(*mpo_destroy_sysv_sem_label_t)(struct label *label);
+typedef void	(*mpo_cleanup_sysv_sem_t)(struct label *semalabel);
+typedef void	(*mpo_create_sysv_sem_t)(struct ucred *cred,
+		    struct semid_kernel *semakptr, struct label *semalabel);
+typedef int	(*mpo_check_sysv_semctl_t)(struct ucred *cred,
+		    struct semid_kernel *semakptr, struct label *semaklabel,
+		    int cmd);
+typedef int	(*mpo_check_sysv_semget_t)(struct ucred *cred,
+		    struct semid_kernel *semakptr, struct label *semaklabel);
+typedef int	(*mpo_check_sysv_semop_t)(struct ucred *cred,
+		    struct semid_kernel *semakptr, struct label *semaklabel,
+		    size_t accesstype);
+
+/*
+ * Object: struct shmid_kernel (System V shared memory segment)
+ */
+typedef void	(*mpo_init_sysv_shm_label_t)(struct label *label);
+typedef void	(*mpo_destroy_sysv_shm_label_t)(struct label *label);
+typedef void	(*mpo_cleanup_sysv_shm_t)(struct label *shmlabel);
+typedef void	(*mpo_create_sysv_shm_t)(struct ucred *cred,
+		    struct shmid_kernel *shmsegptr, struct label *shmlabel);
+typedef int	(*mpo_check_sysv_shmat_t)(struct ucred *cred,
+		    struct shmid_kernel *shmsegptr,
+		    struct label *shmseglabel, int shmflg);
+typedef int	(*mpo_check_sysv_shmctl_t)(struct ucred *cred,
+		    struct shmid_kernel *shmsegptr,
+		    struct label *shmseglabel, int cmd);
+typedef int	(*mpo_check_sysv_shmdt_t)(struct ucred *cred,
+		    struct shmid_kernel *shmsegptr,
+		    struct label *shmseglabel);
+typedef int	(*mpo_check_sysv_shmget_t)(struct ucred *cred,
+		    struct shmid_kernel *shmsegptr,
+		    struct label *shmseglabel, int shmflg);
+
+/*
+ * Object: struct socket (Socket)
+ */
+typedef int	(*mpo_init_socket_label_t)(struct label *label, int flag);
+typedef int	(*mpo_init_socket_peer_label_t)(struct label *label,
+		    int flag);
+typedef void	(*mpo_destroy_socket_label_t)(struct label *label);
+typedef void	(*mpo_destroy_socket_peer_label_t)(struct label *label);
+typedef void	(*mpo_copy_socket_label_t)(struct label *src,
+		    struct label *dest);
+typedef int	(*mpo_externalize_socket_label_t)(struct label *label,
+		    char *element_name, struct sbuf *sb, int *claimed);
+typedef int	(*mpo_externalize_socket_peer_label_t)(struct label *label,
+		    char *element_name, struct sbuf *sb, int *claimed);
+typedef int	(*mpo_internalize_socket_label_t)(struct label *label,
+		    char *element_name, char *element_data, int *claimed);
+typedef void	(*mpo_create_socket_t)(struct ucred *cred, struct socket *so,
+		    struct label *socketlabel);
+typedef void	(*mpo_create_socket_from_socket_t)(struct socket *oldsocket,
+		    struct label *oldsocketlabel, struct socket *newsocket,
+		    struct label *newsocketlabel);
+typedef void	(*mpo_relabel_socket_t)(struct ucred *cred, struct socket *so,
+		    struct label *oldlabel, struct label *newlabel);
+typedef void	(*mpo_set_socket_peer_from_socket_t)(struct socket *oldsocket,
+		    struct label *oldsocketlabel, struct socket *newsocket,
+		    struct label *newsocketpeerlabel);
 typedef int	(*mpo_check_socket_accept_t)(struct ucred *cred,
 		    struct socket *so, struct label *socketlabel);
 typedef int	(*mpo_check_socket_bind_t)(struct ucred *cred,
@@ -505,6 +512,10 @@
 		    struct socket *so, struct label *socketlabel);
 typedef int	(*mpo_check_socket_visible_t)(struct ucred *cred,
 		    struct socket *so, struct label *socketlabel);
+
+/*
+ * Object: system (Global system state)
+ */
 typedef int	(*mpo_check_sysarch_ioperm_t)(struct ucred *cred);
 typedef int	(*mpo_check_system_acct_t)(struct ucred *cred,
 		    struct vnode *vp, struct label *vlabel);
@@ -518,6 +529,44 @@
 typedef int	(*mpo_check_system_sysctl_t)(struct ucred *cred,
 		    struct sysctl_oid *oidp, void *arg1, int arg2,
 		    struct sysctl_req *req);
+
+/*
+ * Object: struct vnode (VFS node)
+ */
+typedef void	(*mpo_init_vnode_label_t)(struct label *label);
+typedef void	(*mpo_destroy_vnode_label_t)(struct label *label);
+typedef int	(*mpo_associate_vnode_extattr_t)(struct mount *mp,
+		    struct label *fslabel, struct vnode *vp,
+		    struct label *vlabel);
+typedef void	(*mpo_associate_vnode_singlelabel_t)(struct mount *mp,
+		    struct label *fslabel, struct vnode *vp,
+		    struct label *vlabel);
+typedef int	(*mpo_create_vnode_extattr_t)(struct ucred *cred,
+		    struct mount *mp, struct label *fslabel,
+		    struct vnode *dvp, struct label *dlabel,
+		    struct vnode *vp, struct label *vlabel,
+		    struct componentname *cnp);
+typedef void	(*mpo_create_mount_t)(struct ucred *cred, struct mount *mp,
+		    struct label *mntlabel, struct label *fslabel);
+typedef void	(*mpo_relabel_vnode_t)(struct ucred *cred, struct vnode *vp,
+		    struct label *vnodelabel, struct label *label);
+typedef int	(*mpo_setlabel_vnode_extattr_t)(struct ucred *cred,
+		    struct vnode *vp, struct label *vlabel,
+		    struct label *intlabel);
+typedef void	(*mpo_copy_vnode_label_t)(struct label *src,
+		    struct label *dest);
+typedef int	(*mpo_externalize_vnode_label_t)(struct label *label,
+		    char *element_name, struct sbuf *sb, int *claimed);
+typedef int	(*mpo_internalize_vnode_label_t)(struct label *label,
+		    char *element_name, char *element_data, int *claimed);
+typedef void	(*mpo_execve_transition_t)(struct ucred *old,
+		    struct ucred *new, struct vnode *vp,
+		    struct label *vnodelabel, struct label *interpvnodelabel,
+		    struct image_params *imgp, struct label *execlabel);
+typedef int	(*mpo_execve_will_transition_t)(struct ucred *old,
+		    struct vnode *vp, struct label *vnodelabel,
+		    struct label *interpvnodelabel,
+		    struct image_params *imgp, struct label *execlabel);
 typedef int	(*mpo_check_vnode_access_t)(struct ucred *cred,
 		    struct vnode *vp, struct label *label, int acc_mode);
 typedef int	(*mpo_check_vnode_chdir_t)(struct ucred *cred,


More information about the trustedbsd-cvs mailing list