summaryrefslogtreecommitdiffstats
path: root/sys/security/mac/mac_framework.h
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2003-11-12 03:14:31 +0000
committerrwatson <rwatson@FreeBSD.org>2003-11-12 03:14:31 +0000
commit77ed6e2d1cbbf9a46dd5ae6d089eeb45ab81fbcb (patch)
treea3d104511a2cb91c797ff9c5bcc6f9c70abc63ce /sys/security/mac/mac_framework.h
parent9352a05d4022d31faee0a088a5df3456001e11ae (diff)
downloadFreeBSD-src-77ed6e2d1cbbf9a46dd5ae6d089eeb45ab81fbcb.zip
FreeBSD-src-77ed6e2d1cbbf9a46dd5ae6d089eeb45ab81fbcb.tar.gz
Modify the MAC Framework so that instead of embedding a (struct label)
in various kernel objects to represent security data, we embed a (struct label *) pointer, which now references labels allocated using a UMA zone (mac_label.c). This allows the size and shape of struct label to be varied without changing the size and shape of these kernel objects, which become part of the frozen ABI with 5-STABLE. This opens the door for boot-time selection of the number of label slots, and hence changes to the bound on the number of simultaneous labeled policies at boot-time instead of compile-time. This also makes it easier to embed label references in new objects as required for locking/caching with fine-grained network stack locking, such as inpcb structures. This change also moves us further in the direction of hiding the structure of kernel objects from MAC policy modules, not to mention dramatically reducing the number of '&' symbols appearing in both the MAC Framework and MAC policy modules, and improving readability. While this results in minimal performance change with MAC enabled, it will observably shrink the size of a number of critical kernel data structures for the !MAC case, and should have a small (but measurable) performance benefit (i.e., struct vnode, struct socket) do to memory conservation and reduced cost of zeroing memory. NOTE: Users of MAC must recompile their kernel and all MAC modules as a result of this change. Because this is an API change, third party MAC modules will also need to be updated to make less use of the '&' symbol. Suggestions from: bmilekic Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'sys/security/mac/mac_framework.h')
-rw-r--r--sys/security/mac/mac_framework.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h
index 7955c25a..1dc6bf1 100644
--- a/sys/security/mac/mac_framework.h
+++ b/sys/security/mac/mac_framework.h
@@ -144,7 +144,6 @@ int mac_init_mbuf_tag(struct m_tag *, int flag);
void mac_init_mount(struct mount *);
void mac_init_proc(struct proc *);
void mac_init_vnode(struct vnode *);
-void mac_init_vnode_label(struct label *);
void mac_copy_mbuf_tag(struct m_tag *, struct m_tag *);
void mac_copy_vnode_label(struct label *, struct label *label);
void mac_destroy_bpfdesc(struct bpf_d *);
@@ -158,7 +157,12 @@ void mac_destroy_proc(struct proc *);
void mac_destroy_mbuf_tag(struct m_tag *);
void mac_destroy_mount(struct mount *);
void mac_destroy_vnode(struct vnode *);
-void mac_destroy_vnode_label(struct label *);
+
+struct label *mac_cred_label_alloc(void);
+void mac_cred_label_free(struct label *label);
+struct label *mac_vnode_label_alloc(void);
+void mac_vnode_label_free(struct label *label);
+void mac_destroy_vnode_label(struct label *);
/*
* Labeling event operations: file system objects, and things that
@@ -220,8 +224,7 @@ void mac_update_ipq(struct mbuf *fragment, struct ipq *ipq);
* Labeling event operations: processes.
*/
void mac_create_cred(struct ucred *cred_parent, struct ucred *cred_child);
-int mac_execve_enter(struct image_params *imgp, struct mac *mac_p,
- struct label *execlabel);
+int mac_execve_enter(struct image_params *imgp, struct mac *mac_p);
void mac_execve_exit(struct image_params *imgp);
void mac_execve_transition(struct ucred *old, struct ucred *new,
struct vnode *vp, struct label *interpvnodelabel,
OpenPOWER on IntegriCloud