summaryrefslogtreecommitdiffstats
path: root/sys/security/mac_biba/mac_biba.c
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2006-12-13 06:03:22 +0000
committercsjp <csjp@FreeBSD.org>2006-12-13 06:03:22 +0000
commit3193aa5601a04fee992eea32323269eed2ca7161 (patch)
treee8a4ada4cf293aac906d3bfc00bd17bdda84350e /sys/security/mac_biba/mac_biba.c
parent7aaca1dfe10d4d80d7e66bc7a75c3c4b748a375d (diff)
downloadFreeBSD-src-3193aa5601a04fee992eea32323269eed2ca7161.zip
FreeBSD-src-3193aa5601a04fee992eea32323269eed2ca7161.tar.gz
Teach the MAC policies which utilize mbuf labeling the new syncache
entry points. Properly initialize the mbuf label based on the label we copy from the PCB. This fixes an LOR between the PCB and syncache code.
Diffstat (limited to 'sys/security/mac_biba/mac_biba.c')
-rw-r--r--sys/security/mac_biba/mac_biba.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c
index cfafc6c..5aa404c 100644
--- a/sys/security/mac_biba/mac_biba.c
+++ b/sys/security/mac_biba/mac_biba.c
@@ -3040,6 +3040,27 @@ mac_biba_associate_nfsd_label(struct ucred *cred)
MAC_BIBA_TYPE_HIGH, 0, NULL);
}
+static void
+mac_biba_init_syncache_from_inpcb(struct label *label, struct inpcb *inp)
+{
+ struct mac_biba *source, *dest;
+
+ source = SLOT(inp->inp_label);
+ dest = SLOT(label);
+ mac_biba_copy_effective(source, dest);
+}
+
+static void
+mac_biba_create_mbuf_from_syncache(struct label *sc_label, struct mbuf *m,
+ struct label *mbuf_label)
+{
+ struct mac_biba *source, *dest;
+
+ source = SLOT(sc_label);
+ dest = SLOT(mbuf_label);
+ mac_biba_copy_effective(source, dest);
+}
+
static struct mac_policy_ops mac_biba_ops =
{
.mpo_init = mac_biba_init,
@@ -3048,6 +3069,7 @@ static struct mac_policy_ops mac_biba_ops =
.mpo_init_devfsdirent_label = mac_biba_init_label,
.mpo_init_ifnet_label = mac_biba_init_label,
.mpo_init_inpcb_label = mac_biba_init_label_waitcheck,
+ .mpo_init_syncache_label = mac_biba_init_label_waitcheck,
.mpo_init_sysv_msgmsg_label = mac_biba_init_label,
.mpo_init_sysv_msgqueue_label = mac_biba_init_label,
.mpo_init_sysv_sem_label = mac_biba_init_label,
@@ -3060,12 +3082,14 @@ static struct mac_policy_ops mac_biba_ops =
.mpo_init_posix_sem_label = mac_biba_init_label,
.mpo_init_socket_label = mac_biba_init_label_waitcheck,
.mpo_init_socket_peer_label = mac_biba_init_label_waitcheck,
+ .mpo_init_syncache_from_inpcb = mac_biba_init_syncache_from_inpcb,
.mpo_init_vnode_label = mac_biba_init_label,
.mpo_destroy_bpfdesc_label = mac_biba_destroy_label,
.mpo_destroy_cred_label = mac_biba_destroy_label,
.mpo_destroy_devfsdirent_label = mac_biba_destroy_label,
.mpo_destroy_ifnet_label = mac_biba_destroy_label,
.mpo_destroy_inpcb_label = mac_biba_destroy_label,
+ .mpo_destroy_syncache_label = mac_biba_destroy_label,
.mpo_destroy_sysv_msgmsg_label = mac_biba_destroy_label,
.mpo_destroy_sysv_msgqueue_label = mac_biba_destroy_label,
.mpo_destroy_sysv_sem_label = mac_biba_destroy_label,
@@ -3108,6 +3132,7 @@ static struct mac_policy_ops mac_biba_ops =
.mpo_create_vnode_extattr = mac_biba_create_vnode_extattr,
.mpo_setlabel_vnode_extattr = mac_biba_setlabel_vnode_extattr,
.mpo_create_mbuf_from_socket = mac_biba_create_mbuf_from_socket,
+ .mpo_create_mbuf_from_syncache = mac_biba_create_mbuf_from_syncache,
.mpo_create_pipe = mac_biba_create_pipe,
.mpo_create_posix_sem = mac_biba_create_posix_sem,
.mpo_create_socket = mac_biba_create_socket,
OpenPOWER on IntegriCloud