summaryrefslogtreecommitdiffstats
path: root/sys/security
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-11-20 15:41:25 +0000
committerrwatson <rwatson@FreeBSD.org>2002-11-20 15:41:25 +0000
commit569048d3f90c1ad80a2befd6f45adeda27d5b370 (patch)
tree51776de3b9188cb829cfb48dbad3e46d3b37ed4e /sys/security
parent8f7431caeb8e8d1dcbcc57542b08b0328692dbb3 (diff)
downloadFreeBSD-src-569048d3f90c1ad80a2befd6f45adeda27d5b370.zip
FreeBSD-src-569048d3f90c1ad80a2befd6f45adeda27d5b370.tar.gz
Introduce p_label, extensible security label storage for the MAC framework
in struct proc. While the process label is actually stored in the struct ucred pointed to by p_ucred, there is a need for transient storage that may be used when asynchronous (deferred) updates need to be performed on the "real" label for locking reasons. Unlike other label storage, this label has no locking semantics, relying on policies to provide their own protection for the label contents, meaning that a policy leaf mutex may be used, avoiding lock order issues. This permits policies that act based on historical process behavior (such as audit policies, the MAC Framework port of LOMAC, etc) can update process properties even when many existing locks are held without violating the lock order. No currently committed policies implement use of this label storage. Approved by: re Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'sys/security')
-rw-r--r--sys/security/mac/mac_framework.c26
-rw-r--r--sys/security/mac/mac_framework.h2
-rw-r--r--sys/security/mac/mac_internal.h26
-rw-r--r--sys/security/mac/mac_net.c26
-rw-r--r--sys/security/mac/mac_pipe.c26
-rw-r--r--sys/security/mac/mac_policy.h2
-rw-r--r--sys/security/mac/mac_process.c26
-rw-r--r--sys/security/mac/mac_syscalls.c26
-rw-r--r--sys/security/mac/mac_system.c26
-rw-r--r--sys/security/mac/mac_vfs.c26
10 files changed, 204 insertions, 8 deletions
diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c
index bf6c999..f9eb44e 100644
--- a/sys/security/mac/mac_framework.c
+++ b/sys/security/mac/mac_framework.c
@@ -185,7 +185,7 @@ SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
static unsigned int nmacmbufs, nmaccreds, nmacifnets, nmacbpfdescs,
nmacsockets, nmacmounts, nmactemp, nmacvnodes, nmacdevfsdirents,
- nmacipqs, nmacpipes;
+ nmacipqs, nmacpipes, nmacprocs;
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mbufs, CTLFLAG_RD,
&nmacmbufs, 0, "number of mbufs in use");
@@ -201,6 +201,8 @@ SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, sockets, CTLFLAG_RD,
&nmacsockets, 0, "number of sockets in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, pipes, CTLFLAG_RD,
&nmacpipes, 0, "number of pipes in use");
+SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, procs, CTLFLAG_RD,
+ &nmacprocs, 0, "number of procs in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mounts, CTLFLAG_RD,
&nmacmounts, 0, "number of mounts in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
@@ -762,6 +764,17 @@ mac_init_pipe(struct pipe *pipe)
mac_init_pipe_label(label);
}
+void
+mac_init_proc(struct proc *p)
+{
+
+ mac_init_label(&p->p_label);
+ MAC_PERFORM(init_proc_label, &p->p_label);
+#ifdef MAC_DEBUG
+ atomic_add_int(&nmacprocs, 1);
+#endif
+}
+
static int
mac_init_socket_label(struct label *label, int flag)
{
@@ -945,6 +958,17 @@ mac_destroy_pipe(struct pipe *pipe)
free(pipe->pipe_label, M_MACPIPELABEL);
}
+void
+mac_destroy_proc(struct proc *p)
+{
+
+ MAC_PERFORM(destroy_proc_label, &p->p_label);
+ mac_destroy_label(&p->p_label);
+#ifdef MAC_DEBUG
+ atomic_subtract_int(&nmacprocs, 1);
+#endif
+}
+
static void
mac_destroy_socket_label(struct label *label)
{
diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h
index 3e7e6bb..89c6efc 100644
--- a/sys/security/mac/mac_framework.h
+++ b/sys/security/mac/mac_framework.h
@@ -146,6 +146,7 @@ int mac_init_socket(struct socket *, int flag);
void mac_init_pipe(struct pipe *);
int mac_init_mbuf(struct mbuf *m, 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_vnode_label(struct label *, struct label *label);
@@ -156,6 +157,7 @@ void mac_destroy_ifnet(struct ifnet *);
void mac_destroy_ipq(struct ipq *);
void mac_destroy_socket(struct socket *);
void mac_destroy_pipe(struct pipe *);
+void mac_destroy_proc(struct proc *);
void mac_destroy_mbuf(struct mbuf *);
void mac_destroy_mount(struct mount *);
void mac_destroy_vnode(struct vnode *);
diff --git a/sys/security/mac/mac_internal.h b/sys/security/mac/mac_internal.h
index bf6c999..f9eb44e 100644
--- a/sys/security/mac/mac_internal.h
+++ b/sys/security/mac/mac_internal.h
@@ -185,7 +185,7 @@ SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
static unsigned int nmacmbufs, nmaccreds, nmacifnets, nmacbpfdescs,
nmacsockets, nmacmounts, nmactemp, nmacvnodes, nmacdevfsdirents,
- nmacipqs, nmacpipes;
+ nmacipqs, nmacpipes, nmacprocs;
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mbufs, CTLFLAG_RD,
&nmacmbufs, 0, "number of mbufs in use");
@@ -201,6 +201,8 @@ SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, sockets, CTLFLAG_RD,
&nmacsockets, 0, "number of sockets in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, pipes, CTLFLAG_RD,
&nmacpipes, 0, "number of pipes in use");
+SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, procs, CTLFLAG_RD,
+ &nmacprocs, 0, "number of procs in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mounts, CTLFLAG_RD,
&nmacmounts, 0, "number of mounts in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
@@ -762,6 +764,17 @@ mac_init_pipe(struct pipe *pipe)
mac_init_pipe_label(label);
}
+void
+mac_init_proc(struct proc *p)
+{
+
+ mac_init_label(&p->p_label);
+ MAC_PERFORM(init_proc_label, &p->p_label);
+#ifdef MAC_DEBUG
+ atomic_add_int(&nmacprocs, 1);
+#endif
+}
+
static int
mac_init_socket_label(struct label *label, int flag)
{
@@ -945,6 +958,17 @@ mac_destroy_pipe(struct pipe *pipe)
free(pipe->pipe_label, M_MACPIPELABEL);
}
+void
+mac_destroy_proc(struct proc *p)
+{
+
+ MAC_PERFORM(destroy_proc_label, &p->p_label);
+ mac_destroy_label(&p->p_label);
+#ifdef MAC_DEBUG
+ atomic_subtract_int(&nmacprocs, 1);
+#endif
+}
+
static void
mac_destroy_socket_label(struct label *label)
{
diff --git a/sys/security/mac/mac_net.c b/sys/security/mac/mac_net.c
index bf6c999..f9eb44e 100644
--- a/sys/security/mac/mac_net.c
+++ b/sys/security/mac/mac_net.c
@@ -185,7 +185,7 @@ SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
static unsigned int nmacmbufs, nmaccreds, nmacifnets, nmacbpfdescs,
nmacsockets, nmacmounts, nmactemp, nmacvnodes, nmacdevfsdirents,
- nmacipqs, nmacpipes;
+ nmacipqs, nmacpipes, nmacprocs;
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mbufs, CTLFLAG_RD,
&nmacmbufs, 0, "number of mbufs in use");
@@ -201,6 +201,8 @@ SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, sockets, CTLFLAG_RD,
&nmacsockets, 0, "number of sockets in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, pipes, CTLFLAG_RD,
&nmacpipes, 0, "number of pipes in use");
+SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, procs, CTLFLAG_RD,
+ &nmacprocs, 0, "number of procs in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mounts, CTLFLAG_RD,
&nmacmounts, 0, "number of mounts in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
@@ -762,6 +764,17 @@ mac_init_pipe(struct pipe *pipe)
mac_init_pipe_label(label);
}
+void
+mac_init_proc(struct proc *p)
+{
+
+ mac_init_label(&p->p_label);
+ MAC_PERFORM(init_proc_label, &p->p_label);
+#ifdef MAC_DEBUG
+ atomic_add_int(&nmacprocs, 1);
+#endif
+}
+
static int
mac_init_socket_label(struct label *label, int flag)
{
@@ -945,6 +958,17 @@ mac_destroy_pipe(struct pipe *pipe)
free(pipe->pipe_label, M_MACPIPELABEL);
}
+void
+mac_destroy_proc(struct proc *p)
+{
+
+ MAC_PERFORM(destroy_proc_label, &p->p_label);
+ mac_destroy_label(&p->p_label);
+#ifdef MAC_DEBUG
+ atomic_subtract_int(&nmacprocs, 1);
+#endif
+}
+
static void
mac_destroy_socket_label(struct label *label)
{
diff --git a/sys/security/mac/mac_pipe.c b/sys/security/mac/mac_pipe.c
index bf6c999..f9eb44e 100644
--- a/sys/security/mac/mac_pipe.c
+++ b/sys/security/mac/mac_pipe.c
@@ -185,7 +185,7 @@ SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
static unsigned int nmacmbufs, nmaccreds, nmacifnets, nmacbpfdescs,
nmacsockets, nmacmounts, nmactemp, nmacvnodes, nmacdevfsdirents,
- nmacipqs, nmacpipes;
+ nmacipqs, nmacpipes, nmacprocs;
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mbufs, CTLFLAG_RD,
&nmacmbufs, 0, "number of mbufs in use");
@@ -201,6 +201,8 @@ SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, sockets, CTLFLAG_RD,
&nmacsockets, 0, "number of sockets in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, pipes, CTLFLAG_RD,
&nmacpipes, 0, "number of pipes in use");
+SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, procs, CTLFLAG_RD,
+ &nmacprocs, 0, "number of procs in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mounts, CTLFLAG_RD,
&nmacmounts, 0, "number of mounts in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
@@ -762,6 +764,17 @@ mac_init_pipe(struct pipe *pipe)
mac_init_pipe_label(label);
}
+void
+mac_init_proc(struct proc *p)
+{
+
+ mac_init_label(&p->p_label);
+ MAC_PERFORM(init_proc_label, &p->p_label);
+#ifdef MAC_DEBUG
+ atomic_add_int(&nmacprocs, 1);
+#endif
+}
+
static int
mac_init_socket_label(struct label *label, int flag)
{
@@ -945,6 +958,17 @@ mac_destroy_pipe(struct pipe *pipe)
free(pipe->pipe_label, M_MACPIPELABEL);
}
+void
+mac_destroy_proc(struct proc *p)
+{
+
+ MAC_PERFORM(destroy_proc_label, &p->p_label);
+ mac_destroy_label(&p->p_label);
+#ifdef MAC_DEBUG
+ atomic_subtract_int(&nmacprocs, 1);
+#endif
+}
+
static void
mac_destroy_socket_label(struct label *label)
{
diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h
index 96fc060..454e6c6 100644
--- a/sys/security/mac/mac_policy.h
+++ b/sys/security/mac/mac_policy.h
@@ -80,6 +80,7 @@ struct mac_policy_ops {
int (*mpo_init_socket_label)(struct label *label, int flag);
int (*mpo_init_socket_peer_label)(struct label *label, int flag);
void (*mpo_init_pipe_label)(struct label *label);
+ void (*mpo_init_proc_label)(struct label *label);
void (*mpo_init_vnode_label)(struct label *label);
void (*mpo_destroy_bpfdesc_label)(struct label *label);
void (*mpo_destroy_cred_label)(struct label *label);
@@ -92,6 +93,7 @@ struct mac_policy_ops {
void (*mpo_destroy_socket_label)(struct label *label);
void (*mpo_destroy_socket_peer_label)(struct label *label);
void (*mpo_destroy_pipe_label)(struct label *label);
+ void (*mpo_destroy_proc_label)(struct label *label);
void (*mpo_destroy_vnode_label)(struct label *label);
void (*mpo_copy_pipe_label)(struct label *src,
struct label *dest);
diff --git a/sys/security/mac/mac_process.c b/sys/security/mac/mac_process.c
index bf6c999..f9eb44e 100644
--- a/sys/security/mac/mac_process.c
+++ b/sys/security/mac/mac_process.c
@@ -185,7 +185,7 @@ SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
static unsigned int nmacmbufs, nmaccreds, nmacifnets, nmacbpfdescs,
nmacsockets, nmacmounts, nmactemp, nmacvnodes, nmacdevfsdirents,
- nmacipqs, nmacpipes;
+ nmacipqs, nmacpipes, nmacprocs;
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mbufs, CTLFLAG_RD,
&nmacmbufs, 0, "number of mbufs in use");
@@ -201,6 +201,8 @@ SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, sockets, CTLFLAG_RD,
&nmacsockets, 0, "number of sockets in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, pipes, CTLFLAG_RD,
&nmacpipes, 0, "number of pipes in use");
+SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, procs, CTLFLAG_RD,
+ &nmacprocs, 0, "number of procs in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mounts, CTLFLAG_RD,
&nmacmounts, 0, "number of mounts in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
@@ -762,6 +764,17 @@ mac_init_pipe(struct pipe *pipe)
mac_init_pipe_label(label);
}
+void
+mac_init_proc(struct proc *p)
+{
+
+ mac_init_label(&p->p_label);
+ MAC_PERFORM(init_proc_label, &p->p_label);
+#ifdef MAC_DEBUG
+ atomic_add_int(&nmacprocs, 1);
+#endif
+}
+
static int
mac_init_socket_label(struct label *label, int flag)
{
@@ -945,6 +958,17 @@ mac_destroy_pipe(struct pipe *pipe)
free(pipe->pipe_label, M_MACPIPELABEL);
}
+void
+mac_destroy_proc(struct proc *p)
+{
+
+ MAC_PERFORM(destroy_proc_label, &p->p_label);
+ mac_destroy_label(&p->p_label);
+#ifdef MAC_DEBUG
+ atomic_subtract_int(&nmacprocs, 1);
+#endif
+}
+
static void
mac_destroy_socket_label(struct label *label)
{
diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c
index bf6c999..f9eb44e 100644
--- a/sys/security/mac/mac_syscalls.c
+++ b/sys/security/mac/mac_syscalls.c
@@ -185,7 +185,7 @@ SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
static unsigned int nmacmbufs, nmaccreds, nmacifnets, nmacbpfdescs,
nmacsockets, nmacmounts, nmactemp, nmacvnodes, nmacdevfsdirents,
- nmacipqs, nmacpipes;
+ nmacipqs, nmacpipes, nmacprocs;
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mbufs, CTLFLAG_RD,
&nmacmbufs, 0, "number of mbufs in use");
@@ -201,6 +201,8 @@ SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, sockets, CTLFLAG_RD,
&nmacsockets, 0, "number of sockets in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, pipes, CTLFLAG_RD,
&nmacpipes, 0, "number of pipes in use");
+SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, procs, CTLFLAG_RD,
+ &nmacprocs, 0, "number of procs in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mounts, CTLFLAG_RD,
&nmacmounts, 0, "number of mounts in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
@@ -762,6 +764,17 @@ mac_init_pipe(struct pipe *pipe)
mac_init_pipe_label(label);
}
+void
+mac_init_proc(struct proc *p)
+{
+
+ mac_init_label(&p->p_label);
+ MAC_PERFORM(init_proc_label, &p->p_label);
+#ifdef MAC_DEBUG
+ atomic_add_int(&nmacprocs, 1);
+#endif
+}
+
static int
mac_init_socket_label(struct label *label, int flag)
{
@@ -945,6 +958,17 @@ mac_destroy_pipe(struct pipe *pipe)
free(pipe->pipe_label, M_MACPIPELABEL);
}
+void
+mac_destroy_proc(struct proc *p)
+{
+
+ MAC_PERFORM(destroy_proc_label, &p->p_label);
+ mac_destroy_label(&p->p_label);
+#ifdef MAC_DEBUG
+ atomic_subtract_int(&nmacprocs, 1);
+#endif
+}
+
static void
mac_destroy_socket_label(struct label *label)
{
diff --git a/sys/security/mac/mac_system.c b/sys/security/mac/mac_system.c
index bf6c999..f9eb44e 100644
--- a/sys/security/mac/mac_system.c
+++ b/sys/security/mac/mac_system.c
@@ -185,7 +185,7 @@ SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
static unsigned int nmacmbufs, nmaccreds, nmacifnets, nmacbpfdescs,
nmacsockets, nmacmounts, nmactemp, nmacvnodes, nmacdevfsdirents,
- nmacipqs, nmacpipes;
+ nmacipqs, nmacpipes, nmacprocs;
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mbufs, CTLFLAG_RD,
&nmacmbufs, 0, "number of mbufs in use");
@@ -201,6 +201,8 @@ SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, sockets, CTLFLAG_RD,
&nmacsockets, 0, "number of sockets in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, pipes, CTLFLAG_RD,
&nmacpipes, 0, "number of pipes in use");
+SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, procs, CTLFLAG_RD,
+ &nmacprocs, 0, "number of procs in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mounts, CTLFLAG_RD,
&nmacmounts, 0, "number of mounts in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
@@ -762,6 +764,17 @@ mac_init_pipe(struct pipe *pipe)
mac_init_pipe_label(label);
}
+void
+mac_init_proc(struct proc *p)
+{
+
+ mac_init_label(&p->p_label);
+ MAC_PERFORM(init_proc_label, &p->p_label);
+#ifdef MAC_DEBUG
+ atomic_add_int(&nmacprocs, 1);
+#endif
+}
+
static int
mac_init_socket_label(struct label *label, int flag)
{
@@ -945,6 +958,17 @@ mac_destroy_pipe(struct pipe *pipe)
free(pipe->pipe_label, M_MACPIPELABEL);
}
+void
+mac_destroy_proc(struct proc *p)
+{
+
+ MAC_PERFORM(destroy_proc_label, &p->p_label);
+ mac_destroy_label(&p->p_label);
+#ifdef MAC_DEBUG
+ atomic_subtract_int(&nmacprocs, 1);
+#endif
+}
+
static void
mac_destroy_socket_label(struct label *label)
{
diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c
index bf6c999..f9eb44e 100644
--- a/sys/security/mac/mac_vfs.c
+++ b/sys/security/mac/mac_vfs.c
@@ -185,7 +185,7 @@ SYSCTL_NODE(_security_mac_debug, OID_AUTO, counters, CTLFLAG_RW, 0,
static unsigned int nmacmbufs, nmaccreds, nmacifnets, nmacbpfdescs,
nmacsockets, nmacmounts, nmactemp, nmacvnodes, nmacdevfsdirents,
- nmacipqs, nmacpipes;
+ nmacipqs, nmacpipes, nmacprocs;
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mbufs, CTLFLAG_RD,
&nmacmbufs, 0, "number of mbufs in use");
@@ -201,6 +201,8 @@ SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, sockets, CTLFLAG_RD,
&nmacsockets, 0, "number of sockets in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, pipes, CTLFLAG_RD,
&nmacpipes, 0, "number of pipes in use");
+SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, procs, CTLFLAG_RD,
+ &nmacprocs, 0, "number of procs in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, mounts, CTLFLAG_RD,
&nmacmounts, 0, "number of mounts in use");
SYSCTL_UINT(_security_mac_debug_counters, OID_AUTO, temp, CTLFLAG_RD,
@@ -762,6 +764,17 @@ mac_init_pipe(struct pipe *pipe)
mac_init_pipe_label(label);
}
+void
+mac_init_proc(struct proc *p)
+{
+
+ mac_init_label(&p->p_label);
+ MAC_PERFORM(init_proc_label, &p->p_label);
+#ifdef MAC_DEBUG
+ atomic_add_int(&nmacprocs, 1);
+#endif
+}
+
static int
mac_init_socket_label(struct label *label, int flag)
{
@@ -945,6 +958,17 @@ mac_destroy_pipe(struct pipe *pipe)
free(pipe->pipe_label, M_MACPIPELABEL);
}
+void
+mac_destroy_proc(struct proc *p)
+{
+
+ MAC_PERFORM(destroy_proc_label, &p->p_label);
+ mac_destroy_label(&p->p_label);
+#ifdef MAC_DEBUG
+ atomic_subtract_int(&nmacprocs, 1);
+#endif
+}
+
static void
mac_destroy_socket_label(struct label *label)
{
OpenPOWER on IntegriCloud