diff options
author | rwatson <rwatson@FreeBSD.org> | 2002-11-20 15:41:25 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2002-11-20 15:41:25 +0000 |
commit | 569048d3f90c1ad80a2befd6f45adeda27d5b370 (patch) | |
tree | 51776de3b9188cb829cfb48dbad3e46d3b37ed4e /sys/security/mac/mac_syscalls.c | |
parent | 8f7431caeb8e8d1dcbcc57542b08b0328692dbb3 (diff) | |
download | FreeBSD-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/mac/mac_syscalls.c')
-rw-r--r-- | sys/security/mac/mac_syscalls.c | 26 |
1 files changed, 25 insertions, 1 deletions
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) { |