Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
/*-
|
2004-02-22 00:33:12 +00:00
|
|
|
* Copyright (c) 1999-2002 Robert N. M. Watson
|
2005-04-16 18:46:29 +00:00
|
|
|
* Copyright (c) 2001-2005 Networks Associates Technology, Inc.
|
2006-04-26 14:18:55 +00:00
|
|
|
* Copyright (c) 2005-2006 SPARTA, Inc.
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This software was developed by Robert Watson for the TrustedBSD Project.
|
|
|
|
*
|
2002-11-04 01:42:39 +00:00
|
|
|
* This software was developed for the FreeBSD Project in part by Network
|
|
|
|
* Associates Laboratories, the Security Research Division of Network
|
|
|
|
* Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
|
|
|
|
* as part of the DARPA CHATS research program.
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
*
|
When devfs cloning takes place, provide access to the credential of the
process that caused the clone event to take place for the device driver
creating the device. This allows cloned device drivers to adapt the
device node based on security aspects of the process, such as the uid,
gid, and MAC label.
- Add a cred reference to struct cdev, so that when a device node is
instantiated as a vnode, the cloning credential can be exposed to
MAC.
- Add make_dev_cred(), a version of make_dev() that additionally
accepts the credential to stick in the struct cdev. Implement it and
make_dev() in terms of a back-end make_dev_credv().
- Add a new event handler, dev_clone_cred, which can be registered to
receive the credential instead of dev_clone, if desired.
- Modify the MAC entry point mac_create_devfs_device() to accept an
optional credential pointer (may be NULL), so that MAC policies can
inspect and act on the label or other elements of the credential
when initializing the skeleton device protections.
- Modify tty_pty.c to register clone_dev_cred and invoke make_dev_cred(),
so that the pty clone credential is exposed to the MAC Framework.
While currently primarily focussed on MAC policies, this change is also
a prerequisite for changes to allow ptys to be instantiated with the UID
of the process looking up the pty. This requires further changes to the
pty driver -- in particular, to immediately recycle pty nodes on last
close so that the credential-related state can be recreated on next
lookup.
Submitted by: Andrew Reisse <andrew.reisse@sparta.com>
Obtained from: TrustedBSD Project
Sponsored by: SPAWAR, SPARTA
MFC after: 1 week
MFC note: Merge to 6.x, but not 5.x for ABI reasons
2005-07-14 10:22:09 +00:00
|
|
|
* This software was enhanced by SPARTA ISSO under SPAWAR contract
|
|
|
|
* N66001-04-C-6019 ("SEFOS").
|
|
|
|
*
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Kernel interface for MAC policy modules.
|
|
|
|
*/
|
2006-12-28 23:23:35 +00:00
|
|
|
#ifndef _SYS_SECURITY_MAC_MAC_POLICY_H_
|
|
|
|
#define _SYS_SECURITY_MAC_MAC_POLICY_H_
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
2007-02-06 10:59:23 +00:00
|
|
|
#ifndef _KERNEL
|
|
|
|
#error "no user-serviceable parts inside"
|
|
|
|
#endif
|
|
|
|
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
/*-
|
|
|
|
* Pluggable access control policy definition structure.
|
|
|
|
*
|
2006-12-23 22:21:13 +00:00
|
|
|
* List of operations that are performed as part of the implementation of a
|
|
|
|
* MAC policy. Policy implementors declare operations with a mac_policy_ops
|
|
|
|
* structure, and using the MAC_POLICY_SET() macro. If an entry point is not
|
|
|
|
* declared, then then the policy will be ignored during evaluation of that
|
|
|
|
* event or check.
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
*
|
|
|
|
* Operations are sorted first by general class of operation, then
|
|
|
|
* alphabetically.
|
|
|
|
*/
|
2006-10-22 11:52:19 +00:00
|
|
|
#include <sys/acl.h> /* XXX acl_type_t */
|
|
|
|
|
2003-06-22 16:36:00 +00:00
|
|
|
struct acl;
|
2007-04-21 22:08:48 +00:00
|
|
|
struct auditinfo;
|
2007-07-05 06:45:37 +00:00
|
|
|
struct auditinfo_addr;
|
2004-02-26 16:15:14 +00:00
|
|
|
struct bpf_d;
|
2006-10-30 15:20:49 +00:00
|
|
|
struct cdev;
|
2003-06-22 16:36:00 +00:00
|
|
|
struct componentname;
|
|
|
|
struct devfs_dirent;
|
2004-02-26 16:15:14 +00:00
|
|
|
struct ifnet;
|
|
|
|
struct image_params;
|
Introduce a MAC label reference in 'struct inpcb', which caches
the MAC label referenced from 'struct socket' in the IPv4 and
IPv6-based protocols. This permits MAC labels to be checked during
network delivery operations without dereferencing inp->inp_socket
to get to so->so_label, which will eventually avoid our having to
grab the socket lock during delivery at the network layer.
This change introduces 'struct inpcb' as a labeled object to the
MAC Framework, along with the normal circus of entry points:
initialization, creation from socket, destruction, as well as a
delivery access control check.
For most policies, the inpcb label will simply be a cache of the
socket label, so a new protocol switch method is introduced,
pr_sosetlabel() to notify protocols that the socket layer label
has been updated so that the cache can be updated while holding
appropriate locks. Most protocols implement this using
pru_sosetlabel_null(), but IPv4/IPv6 protocols using inpcbs use
the the worker function in_pcbsosetlabel(), which calls into the
MAC Framework to perform a cache update.
Biba, LOMAC, and MLS implement these entry points, as do the stub
policy, and test policy.
Reviewed by: sam, bms
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2003-11-18 00:39:07 +00:00
|
|
|
struct inpcb;
|
2003-06-22 16:36:00 +00:00
|
|
|
struct ipq;
|
2005-05-04 10:39:15 +00:00
|
|
|
struct ksem;
|
2003-06-22 16:36:00 +00:00
|
|
|
struct label;
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct mac_policy_conf;
|
2003-06-22 16:36:00 +00:00
|
|
|
struct mbuf;
|
|
|
|
struct mount;
|
2006-09-09 16:35:44 +00:00
|
|
|
struct msg;
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msqid_kernel;
|
Coalesce pipe allocations and frees. Previously, the pipe code
would allocate two 'struct pipe's from the pipe zone, and malloc a
mutex.
- Create a new "struct pipepair" object holding the two 'struct
pipe' instances, struct mutex, and struct label reference. Pipe
structures now have a back-pointer to the pipe pair, and a
'pipe_present' flag to indicate whether the half has been
closed.
- Perform mutex init/destroy in zone init/destroy, avoiding
reallocating the mutex for each pipe. Perform most pipe structure
setup in zone constructor.
- VM memory mappings for pageable buffers are still done outside of
the UMA zone.
- Change MAC API to speak 'struct pipepair' instead of 'struct pipe',
update many policies. MAC labels are also handled outside of the
UMA zone for now. Label-only policy modules don't have to be
recompiled, but if a module is recompiled, its pipe entry points
will need to be updated. If a module actually reached into the
pipe structures (unlikely), that would also need to be modified.
These changes substantially simplify failure handling in the pipe
code as there are many fewer possible failure modes.
On half-close, pipes no longer free the 'struct pipe' for the closed
half until a full-close takes place. However, VM mapped buffers
are still released on half-close.
Some code refactoring is now possible to clean up some of the back
references, etc; this patch attempts not to change the structure
of most of the pipe implementation, only allocation/free code
paths, so as to avoid introducing bugs (hopefully).
This cuts about 8%-9% off the cost of sequential pipe allocation
and free in system call tests on UP and SMP in my micro-benchmarks.
May or may not make a difference in macro-benchmarks, but doing
less work is good.
Reviewed by: juli, tjr
Testing help: dwhite, fenestro, scottl, et al
2004-02-01 05:56:51 +00:00
|
|
|
struct pipepair;
|
2004-02-26 20:44:50 +00:00
|
|
|
struct proc;
|
2003-06-23 01:26:34 +00:00
|
|
|
struct sbuf;
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct semid_kernel;
|
|
|
|
struct shmid_kernel;
|
2004-02-26 20:44:50 +00:00
|
|
|
struct sockaddr;
|
2003-06-22 16:36:00 +00:00
|
|
|
struct socket;
|
2004-02-22 12:31:44 +00:00
|
|
|
struct sysctl_oid;
|
|
|
|
struct sysctl_req;
|
2004-02-26 20:44:50 +00:00
|
|
|
struct thread;
|
2003-06-22 16:36:00 +00:00
|
|
|
struct ucred;
|
|
|
|
struct uio;
|
2004-02-26 16:15:14 +00:00
|
|
|
struct vattr;
|
2003-06-22 16:36:00 +00:00
|
|
|
struct vnode;
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
|
|
|
* Policy module operations.
|
|
|
|
*/
|
|
|
|
typedef void (*mpo_destroy_t)(struct mac_policy_conf *mpc);
|
|
|
|
typedef void (*mpo_init_t)(struct mac_policy_conf *mpc);
|
2002-08-19 17:59:48 +00:00
|
|
|
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
|
|
|
* General policy-directed security system call so that policies may
|
2006-12-23 22:21:13 +00:00
|
|
|
* implement new services without reserving explicit system call numbers.
|
2006-04-26 14:18:55 +00:00
|
|
|
*/
|
|
|
|
typedef int (*mpo_syscall_t)(struct thread *td, int call, void *arg);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Place-holder function pointers for ABI-compatibility purposes.
|
|
|
|
*/
|
|
|
|
typedef void (*mpo_placeholder_t)(void);
|
|
|
|
|
|
|
|
/*
|
2006-12-23 22:21:13 +00:00
|
|
|
* 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.
|
2006-04-26 14:18:55 +00:00
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_bpfdesc_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_cred_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_devfs_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_ifnet_init_label_t)(struct label *label);
|
|
|
|
typedef int (*mpo_inpcb_init_label_t)(struct label *label, int flag);
|
|
|
|
typedef void (*mpo_sysvmsg_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_sysvmsq_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_sysvsem_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_sysvshm_init_label_t)(struct label *label);
|
|
|
|
typedef int (*mpo_ipq_init_label_t)(struct label *label, int flag);
|
|
|
|
typedef int (*mpo_mbuf_init_label_t)(struct label *label, int flag);
|
|
|
|
typedef void (*mpo_mount_init_label_t)(struct label *label);
|
|
|
|
typedef int (*mpo_socket_init_label_t)(struct label *label, int flag);
|
|
|
|
typedef int (*mpo_socketpeer_init_label_t)(struct label *label,
|
2006-04-26 14:18:55 +00:00
|
|
|
int flag);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_pipe_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_posixsem_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_proc_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_vnode_init_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_bpfdesc_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_cred_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_devfs_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_ifnet_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_inpcb_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_sysvmsg_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_sysvmsq_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_sysvsem_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_sysvshm_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_ipq_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_mbuf_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_mount_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_socket_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_socketpeer_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_pipe_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_posixsem_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_proc_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_vnode_destroy_label_t)(struct label *label);
|
|
|
|
typedef void (*mpo_sysvmsg_cleanup_t)(struct label *msglabel);
|
|
|
|
typedef void (*mpo_sysvmsq_cleanup_t)(struct label *msqlabel);
|
|
|
|
typedef void (*mpo_sysvsem_cleanup_t)(struct label *semalabel);
|
|
|
|
typedef void (*mpo_sysvshm_cleanup_t)(struct label *shmlabel);
|
|
|
|
typedef void (*mpo_cred_copy_label_t)(struct label *src,
|
2003-12-06 21:48:03 +00:00
|
|
|
struct label *dest);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_ifnet_copy_label_t)(struct label *src,
|
2004-06-24 03:34:46 +00:00
|
|
|
struct label *dest);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_mbuf_copy_label_t)(struct label *src,
|
Move MAC label storage for mbufs into m_tags from the m_pkthdr structure,
returning some additional room in the first mbuf in a chain, and
avoiding feature-specific contents in the mbuf header. To do this:
- Modify mbuf_to_label() to extract the tag, returning NULL if not
found.
- Introduce mac_init_mbuf_tag() which does most of the work
mac_init_mbuf() used to do, except on an m_tag rather than an
mbuf.
- Scale back mac_init_mbuf() to perform m_tag allocation and invoke
mac_init_mbuf_tag().
- Replace mac_destroy_mbuf() with mac_destroy_mbuf_tag(), since
m_tag's are now GC'd deep in the m_tag/mbuf code rather than
at a higher level when mbufs are directly free()'d.
- Add mac_copy_mbuf_tag() to support m_copy_pkthdr() and related
notions.
- Generally change all references to mbuf labels so that they use
mbuf_to_label() rather than &mbuf->m_pkthdr.label. This
required no changes in the MAC policies (yay!).
- Tweak mbuf release routines to not call mac_destroy_mbuf(),
tag destruction takes care of it for us now.
- Remove MAC magic from m_copy_pkthdr() and m_move_pkthdr() --
the existing m_tag support does all this for us. Note that
we can no longer just zero the m_tag list on the target mbuf,
rather, we have to delete the chain because m_tag's will
already be hung off freshly allocated mbuf's.
- Tweak m_tag copying routines so that if we're copying a MAC
m_tag, we don't do a binary copy, rather, we initialize the
new storage and do a deep copy of the label.
- Remove use of MAC_FLAG_INITIALIZED in a few bizarre places
having to do with mbuf header copies previously.
- When an mbuf is copied in ip_input(), we no longer need to
explicitly copy the label because it will get handled by the
m_tag code now.
- No longer any weird handling of MAC labels in if_loop.c during
header copies.
- Add MPC_LOADTIME_FLAG_LABELMBUFS flag to Biba, MLS, mac_test.
In mac_test, handle the label==NULL case, since it can be
dynamically loaded.
In order to improve performance with this change, introduce the notion
of "lazy MAC label allocation" -- only allocate m_tag storage for MAC
labels if we're running with a policy that uses MAC labels on mbufs.
Policies declare this intent by setting the MPC_LOADTIME_FLAG_LABELMBUFS
flag in their load-time flags field during declaration. Note: this
opens up the possibility of post-boot policy modules getting back NULL
slot entries even though they have policy invariants of non-NULL slot
entries, as the policy might have been loaded after the mbuf was
allocated, leaving the mbuf without label storage. Policies that cannot
handle this case must be declared as NOTLATE, or must be modified.
- mac_labelmbufs holds the current cumulative status as to whether
any policies require mbuf labeling or not. This is updated whenever
the active policy set changes by the function mac_policy_updateflags().
The function iterates the list and checks whether any have the
flag set. Write access to this variable is protected by the policy
list; read access is currently not protected for performance reasons.
This might change if it causes problems.
- Add MAC_POLICY_LIST_ASSERT_EXCLUSIVE() to permit the flags update
function to assert appropriate locks.
- This makes allocation in mac_init_mbuf() conditional on the flag.
Reviewed by: sam
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2003-04-14 20:39:06 +00:00
|
|
|
struct label *dest);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_pipe_copy_label_t)(struct label *src,
|
Revised APIs for user process label management; the existing APIs relied
on all label parsing occuring in userland, and knowledge of the loaded
policies in the user libraries. This revision of the API pushes that
parsing into the kernel, avoiding the need for shared library support
of policies in userland, permitting statically linked binaries (such
as ls, ps, and ifconfig) to use MAC labels. In these API revisions,
high level parsing of the MAC label is done in the MAC Framework,
and interpretation of label elements is delegated to the MAC policy
modules. This permits modules to export zero or more label elements
to user space if desired, and support them in the manner they want
and with the semantics they want. This is believed to be the final
revision of this interface: from the perspective of user applications,
the API has actually not changed, although the ABI has.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-22 14:27:44 +00:00
|
|
|
struct label *dest);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_socket_copy_label_t)(struct label *src,
|
Implement sockets support for __mac_get_fd() and __mac_set_fd()
system calls, and prefer these calls over getsockopt()/setsockopt()
for ABI reasons. When addressing UNIX domain sockets, these calls
retrieve and modify the socket label, not the label of the
rendezvous vnode.
- Create mac_copy_socket_label() entry point based on
mac_copy_pipe_label() entry point, intended to copy the socket
label into temporary storage that doesn't require a socket lock
to be held (currently Giant).
- Implement mac_copy_socket_label() for various policies.
- Expose socket label allocation, free, internalize, externalize
entry points as non-static from mac_net.c.
- Use mac_socket_label_set() in __mac_set_fd().
MAC-aware applications may now use mac_get_fd(), mac_set_fd(), and
mac_get_peer() to retrieve and set various socket labels without
directly invoking the getsockopt() interface.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2003-11-16 23:31:45 +00:00
|
|
|
struct label *dest);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_vnode_copy_label_t)(struct label *src,
|
Revised APIs for user process label management; the existing APIs relied
on all label parsing occuring in userland, and knowledge of the loaded
policies in the user libraries. This revision of the API pushes that
parsing into the kernel, avoiding the need for shared library support
of policies in userland, permitting statically linked binaries (such
as ls, ps, and ifconfig) to use MAC labels. In these API revisions,
high level parsing of the MAC label is done in the MAC Framework,
and interpretation of label elements is delegated to the MAC policy
modules. This permits modules to export zero or more label elements
to user space if desired, and support them in the manner they want
and with the semantics they want. This is believed to be the final
revision of this interface: from the perspective of user applications,
the API has actually not changed, although the ABI has.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-22 14:27:44 +00:00
|
|
|
struct label *dest);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_cred_externalize_label_t)(struct label *label,
|
2003-06-23 01:26:34 +00:00
|
|
|
char *element_name, struct sbuf *sb, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_ifnet_externalize_label_t)(struct label *label,
|
2003-06-23 01:26:34 +00:00
|
|
|
char *element_name, struct sbuf *sb, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_pipe_externalize_label_t)(struct label *label,
|
2003-06-23 01:26:34 +00:00
|
|
|
char *element_name, struct sbuf *sb, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_externalize_label_t)(struct label *label,
|
2003-06-23 01:26:34 +00:00
|
|
|
char *element_name, struct sbuf *sb, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socketpeer_externalize_label_t)(struct label *label,
|
2003-06-23 01:26:34 +00:00
|
|
|
char *element_name, struct sbuf *sb, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_externalize_label_t)(struct label *label,
|
2003-06-23 01:26:34 +00:00
|
|
|
char *element_name, struct sbuf *sb, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_cred_internalize_label_t)(struct label *label,
|
Revised APIs for user process label management; the existing APIs relied
on all label parsing occuring in userland, and knowledge of the loaded
policies in the user libraries. This revision of the API pushes that
parsing into the kernel, avoiding the need for shared library support
of policies in userland, permitting statically linked binaries (such
as ls, ps, and ifconfig) to use MAC labels. In these API revisions,
high level parsing of the MAC label is done in the MAC Framework,
and interpretation of label elements is delegated to the MAC policy
modules. This permits modules to export zero or more label elements
to user space if desired, and support them in the manner they want
and with the semantics they want. This is believed to be the final
revision of this interface: from the perspective of user applications,
the API has actually not changed, although the ABI has.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-22 14:27:44 +00:00
|
|
|
char *element_name, char *element_data, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_ifnet_internalize_label_t)(struct label *label,
|
Revised APIs for user process label management; the existing APIs relied
on all label parsing occuring in userland, and knowledge of the loaded
policies in the user libraries. This revision of the API pushes that
parsing into the kernel, avoiding the need for shared library support
of policies in userland, permitting statically linked binaries (such
as ls, ps, and ifconfig) to use MAC labels. In these API revisions,
high level parsing of the MAC label is done in the MAC Framework,
and interpretation of label elements is delegated to the MAC policy
modules. This permits modules to export zero or more label elements
to user space if desired, and support them in the manner they want
and with the semantics they want. This is believed to be the final
revision of this interface: from the perspective of user applications,
the API has actually not changed, although the ABI has.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-22 14:27:44 +00:00
|
|
|
char *element_name, char *element_data, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_pipe_internalize_label_t)(struct label *label,
|
Revised APIs for user process label management; the existing APIs relied
on all label parsing occuring in userland, and knowledge of the loaded
policies in the user libraries. This revision of the API pushes that
parsing into the kernel, avoiding the need for shared library support
of policies in userland, permitting statically linked binaries (such
as ls, ps, and ifconfig) to use MAC labels. In these API revisions,
high level parsing of the MAC label is done in the MAC Framework,
and interpretation of label elements is delegated to the MAC policy
modules. This permits modules to export zero or more label elements
to user space if desired, and support them in the manner they want
and with the semantics they want. This is believed to be the final
revision of this interface: from the perspective of user applications,
the API has actually not changed, although the ABI has.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-22 14:27:44 +00:00
|
|
|
char *element_name, char *element_data, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_internalize_label_t)(struct label *label,
|
Revised APIs for user process label management; the existing APIs relied
on all label parsing occuring in userland, and knowledge of the loaded
policies in the user libraries. This revision of the API pushes that
parsing into the kernel, avoiding the need for shared library support
of policies in userland, permitting statically linked binaries (such
as ls, ps, and ifconfig) to use MAC labels. In these API revisions,
high level parsing of the MAC label is done in the MAC Framework,
and interpretation of label elements is delegated to the MAC policy
modules. This permits modules to export zero or more label elements
to user space if desired, and support them in the manner they want
and with the semantics they want. This is believed to be the final
revision of this interface: from the perspective of user applications,
the API has actually not changed, although the ABI has.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-22 14:27:44 +00:00
|
|
|
char *element_name, char *element_data, int *claimed);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_internalize_label_t)(struct label *label,
|
Revised APIs for user process label management; the existing APIs relied
on all label parsing occuring in userland, and knowledge of the loaded
policies in the user libraries. This revision of the API pushes that
parsing into the kernel, avoiding the need for shared library support
of policies in userland, permitting statically linked binaries (such
as ls, ps, and ifconfig) to use MAC labels. In these API revisions,
high level parsing of the MAC label is done in the MAC Framework,
and interpretation of label elements is delegated to the MAC policy
modules. This permits modules to export zero or more label elements
to user space if desired, and support them in the manner they want
and with the semantics they want. This is believed to be the final
revision of this interface: from the perspective of user applications,
the API has actually not changed, although the ABI has.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-22 14:27:44 +00:00
|
|
|
char *element_name, char *element_data, int *claimed);
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
2006-12-23 22:21:13 +00:00
|
|
|
* Labeling event operations: file system objects, and things that look a lot
|
|
|
|
* like file system objects.
|
2006-04-26 14:18:55 +00:00
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_devfs_vnode_associate_t)(struct mount *mp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *mplabel, struct devfs_dirent *de,
|
Slightly change the semantics of vnode labels for MAC: rather than
"refreshing" the label on the vnode before use, just get the label
right from inception. For single-label file systems, set the label
in the generic VFS getnewvnode() code; for multi-label file systems,
leave the labeling up to the file system. With UFS1/2, this means
reading the extended attribute during vfs_vget() as the inode is
pulled off disk, rather than hitting the extended attributes
frequently during operations later, improving performance. This
also corrects sematics for shared vnode locks, which were not
previously present in the system. This chances the cache
coherrency properties WRT out-of-band access to label data, but in
an acceptable form. With UFS1, there is a small race condition
during automatic extended attribute start -- this is not present
with UFS2, and occurs because EAs aren't available at vnode
inception. We'll introduce a work around for this shortly.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-26 14:38:24 +00:00
|
|
|
struct label *delabel, struct vnode *vp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_associate_extattr_t)(struct mount *mp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *mplabel, struct vnode *vp,
|
|
|
|
struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_vnode_associate_singlelabel_t)(struct mount *mp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *mplabel, struct vnode *vp,
|
|
|
|
struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_devfs_create_device_t)(struct ucred *cred,
|
When devfs cloning takes place, provide access to the credential of the
process that caused the clone event to take place for the device driver
creating the device. This allows cloned device drivers to adapt the
device node based on security aspects of the process, such as the uid,
gid, and MAC label.
- Add a cred reference to struct cdev, so that when a device node is
instantiated as a vnode, the cloning credential can be exposed to
MAC.
- Add make_dev_cred(), a version of make_dev() that additionally
accepts the credential to stick in the struct cdev. Implement it and
make_dev() in terms of a back-end make_dev_credv().
- Add a new event handler, dev_clone_cred, which can be registered to
receive the credential instead of dev_clone, if desired.
- Modify the MAC entry point mac_create_devfs_device() to accept an
optional credential pointer (may be NULL), so that MAC policies can
inspect and act on the label or other elements of the credential
when initializing the skeleton device protections.
- Modify tty_pty.c to register clone_dev_cred and invoke make_dev_cred(),
so that the pty clone credential is exposed to the MAC Framework.
While currently primarily focussed on MAC policies, this change is also
a prerequisite for changes to allow ptys to be instantiated with the UID
of the process looking up the pty. This requires further changes to the
pty driver -- in particular, to immediately recycle pty nodes on last
close so that the credential-related state can be recreated on next
lookup.
Submitted by: Andrew Reisse <andrew.reisse@sparta.com>
Obtained from: TrustedBSD Project
Sponsored by: SPAWAR, SPARTA
MFC after: 1 week
MFC note: Merge to 6.x, but not 5.x for ABI reasons
2005-07-14 10:22:09 +00:00
|
|
|
struct mount *mp, struct cdev *dev,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct devfs_dirent *de, struct label *delabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_devfs_create_directory_t)(struct mount *mp,
|
2006-04-26 14:18:55 +00:00
|
|
|
char *dirname, int dirnamelen, struct devfs_dirent *de,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *delabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_devfs_create_symlink_t)(struct ucred *cred,
|
2002-12-09 03:44:28 +00:00
|
|
|
struct mount *mp, struct devfs_dirent *dd,
|
|
|
|
struct label *ddlabel, struct devfs_dirent *de,
|
|
|
|
struct label *delabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_create_extattr_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct mount *mp, struct label *mplabel,
|
|
|
|
struct vnode *dvp, struct label *dvplabel,
|
|
|
|
struct vnode *vp, struct label *vplabel,
|
Slightly change the semantics of vnode labels for MAC: rather than
"refreshing" the label on the vnode before use, just get the label
right from inception. For single-label file systems, set the label
in the generic VFS getnewvnode() code; for multi-label file systems,
leave the labeling up to the file system. With UFS1/2, this means
reading the extended attribute during vfs_vget() as the inode is
pulled off disk, rather than hitting the extended attributes
frequently during operations later, improving performance. This
also corrects sematics for shared vnode locks, which were not
previously present in the system. This chances the cache
coherrency properties WRT out-of-band access to label data, but in
an acceptable form. With UFS1, there is a small race condition
during automatic extended attribute start -- this is not present
with UFS2, and occurs because EAs aren't available at vnode
inception. We'll introduce a work around for this shortly.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-26 14:38:24 +00:00
|
|
|
struct componentname *cnp);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_mount_create_t)(struct ucred *cred, struct mount *mp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *mplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_vnode_relabel_t)(struct ucred *cred, struct vnode *vp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *vplabel, struct label *label);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_setlabel_extattr_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
Slightly change the semantics of vnode labels for MAC: rather than
"refreshing" the label on the vnode before use, just get the label
right from inception. For single-label file systems, set the label
in the generic VFS getnewvnode() code; for multi-label file systems,
leave the labeling up to the file system. With UFS1/2, this means
reading the extended attribute during vfs_vget() as the inode is
pulled off disk, rather than hitting the extended attributes
frequently during operations later, improving performance. This
also corrects sematics for shared vnode locks, which were not
previously present in the system. This chances the cache
coherrency properties WRT out-of-band access to label data, but in
an acceptable form. With UFS1, there is a small race condition
during automatic extended attribute start -- this is not present
with UFS2, and occurs because EAs aren't available at vnode
inception. We'll introduce a work around for this shortly.
Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-26 14:38:24 +00:00
|
|
|
struct label *intlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_devfs_update_t)(struct mount *mp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct devfs_dirent *de, struct label *delabel,
|
|
|
|
struct vnode *vp, struct label *vplabel);
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
|
|
|
* Labeling event operations: IPC objects.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_socket_create_mbuf_t)(struct socket *so,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *solabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_socket_create_t)(struct ucred *cred, struct socket *so,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *solabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_socket_newconn_t)(struct socket *oldso,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *oldsolabel, struct socket *newso,
|
|
|
|
struct label *newsolabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_socket_relabel_t)(struct ucred *cred, struct socket *so,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct label *oldlabel, struct label *newlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_pipe_relabel_t)(struct ucred *cred, struct pipepair *pp,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct label *oldlabel, struct label *newlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_socketpeer_set_from_mbuf_t)(struct mbuf *m,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *mlabel, struct socket *so,
|
|
|
|
struct label *sopeerlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_socketpeer_set_from_socket_t)(struct socket *oldso,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *oldsolabel, struct socket *newso,
|
|
|
|
struct label *newsopeerlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_pipe_create_t)(struct ucred *cred, struct pipepair *pp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *pplabel);
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
|
|
|
* Labeling event operations: System V IPC primitives.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_sysvmsg_create_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msqid_kernel *msqkptr, struct label *msqlabel,
|
|
|
|
struct msg *msgptr, struct label *msglabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_sysvmsq_create_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msqid_kernel *msqkptr, struct label *msqlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_sysvsem_create_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct semid_kernel *semakptr, struct label *semalabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_sysvshm_create_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct shmid_kernel *shmsegptr, struct label *shmlabel);
|
|
|
|
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
|
|
|
* Labeling event operations: POSIX (global/inter-process) semaphores.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_posixsem_create_t)(struct ucred *cred,
|
2007-10-21 11:11:07 +00:00
|
|
|
struct ksem *ks, struct label *kslabel);
|
2005-05-04 10:39:15 +00:00
|
|
|
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
|
|
|
* Labeling event operations: network objects.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_bpfdesc_create_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct bpf_d *d, struct label *dlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_ifnet_create_t)(struct ifnet *ifp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *ifplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_inpcb_create_t)(struct socket *so,
|
Introduce a MAC label reference in 'struct inpcb', which caches
the MAC label referenced from 'struct socket' in the IPv4 and
IPv6-based protocols. This permits MAC labels to be checked during
network delivery operations without dereferencing inp->inp_socket
to get to so->so_label, which will eventually avoid our having to
grab the socket lock during delivery at the network layer.
This change introduces 'struct inpcb' as a labeled object to the
MAC Framework, along with the normal circus of entry points:
initialization, creation from socket, destruction, as well as a
delivery access control check.
For most policies, the inpcb label will simply be a cache of the
socket label, so a new protocol switch method is introduced,
pr_sosetlabel() to notify protocols that the socket layer label
has been updated so that the cache can be updated while holding
appropriate locks. Most protocols implement this using
pru_sosetlabel_null(), but IPv4/IPv6 protocols using inpcbs use
the the worker function in_pcbsosetlabel(), which calls into the
MAC Framework to perform a cache update.
Biba, LOMAC, and MLS implement these entry points, as do the stub
policy, and test policy.
Reviewed by: sam, bms
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2003-11-18 00:39:07 +00:00
|
|
|
struct label *solabel, struct inpcb *inp,
|
|
|
|
struct label *inplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_ipq_create_t)(struct mbuf *m, struct label *mlabel,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct ipq *ipq, struct label *ipqlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_ipq_reassemble)
|
2007-04-22 19:55:56 +00:00
|
|
|
(struct ipq *ipq, struct label *ipqlabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_netinet_fragment_t)(struct mbuf *m,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *mlabel, struct mbuf *frag,
|
|
|
|
struct label *fraglabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_inpcb_create_mbuf_t)(struct inpcb *inp,
|
2003-12-17 14:55:11 +00:00
|
|
|
struct label *inplabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-04-22 19:55:56 +00:00
|
|
|
typedef void (*mpo_create_mbuf_linklayer_t)(struct ifnet *ifp,
|
|
|
|
struct label *ifplabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_bpfdesc_create_mbuf_t)(struct bpf_d *d,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *dlabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_ifnet_create_mbuf_t)(struct ifnet *ifp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *ifplabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_mbuf_create_multicast_encap_t)(struct mbuf *m,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *mlabel, struct ifnet *ifp,
|
|
|
|
struct label *ifplabel, struct mbuf *mnew,
|
|
|
|
struct label *mnewlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_mbuf_create_netlayer_t)(struct mbuf *m,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *mlabel, struct mbuf *mnew,
|
|
|
|
struct label *mnewlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_ipq_match_t)(struct mbuf *m, struct label *mlabel,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct ipq *ipq, struct label *ipqlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_netinet_icmp_reply_t)(struct mbuf *m,
|
2006-04-26 14:18:55 +00:00
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_netinet_tcp_reply_t)(struct mbuf *m,
|
2003-08-21 18:21:22 +00:00
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_ifnet_relabel_t)(struct ucred *cred, struct ifnet *ifp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *ifplabel, struct label *newlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_ipq_update_t)(struct mbuf *m, struct label *mlabel,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct ipq *ipq, struct label *ipqlabel);
|
2006-04-26 14:18:55 +00:00
|
|
|
typedef void (*mpo_inpcb_sosetlabel_t)(struct socket *so,
|
Introduce a MAC label reference in 'struct inpcb', which caches
the MAC label referenced from 'struct socket' in the IPv4 and
IPv6-based protocols. This permits MAC labels to be checked during
network delivery operations without dereferencing inp->inp_socket
to get to so->so_label, which will eventually avoid our having to
grab the socket lock during delivery at the network layer.
This change introduces 'struct inpcb' as a labeled object to the
MAC Framework, along with the normal circus of entry points:
initialization, creation from socket, destruction, as well as a
delivery access control check.
For most policies, the inpcb label will simply be a cache of the
socket label, so a new protocol switch method is introduced,
pr_sosetlabel() to notify protocols that the socket layer label
has been updated so that the cache can be updated while holding
appropriate locks. Most protocols implement this using
pru_sosetlabel_null(), but IPv4/IPv6 protocols using inpcbs use
the the worker function in_pcbsosetlabel(), which calls into the
MAC Framework to perform a cache update.
Biba, LOMAC, and MLS implement these entry points, as do the stub
policy, and test policy.
Reviewed by: sam, bms
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2003-11-18 00:39:07 +00:00
|
|
|
struct label *label, struct inpcb *inp,
|
|
|
|
struct label *inplabel);
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_mbuf_create_from_firewall_t)(struct mbuf *m,
|
2006-09-12 04:25:13 +00:00
|
|
|
struct label *label);
|
2006-12-13 06:00:57 +00:00
|
|
|
typedef void (*mpo_destroy_syncache_label_t)(struct label *label);
|
|
|
|
typedef int (*mpo_init_syncache_label_t)(struct label *label, int flag);
|
|
|
|
typedef void (*mpo_init_syncache_from_inpcb_t)(struct label *label,
|
|
|
|
struct inpcb *inp);
|
|
|
|
typedef void (*mpo_create_mbuf_from_syncache_t)(struct label *sc_label,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct mbuf *m, struct label *mlabel);
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
|
|
|
* Labeling event operations: processes.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_vnode_execve_transition_t)(struct ucred *old,
|
2006-04-26 14:18:55 +00:00
|
|
|
struct ucred *new, struct vnode *vp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *vplabel, struct label *interpvnodelabel,
|
2002-11-08 18:04:00 +00:00
|
|
|
struct image_params *imgp, struct label *execlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_execve_will_transition_t)(struct ucred *old,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
2002-11-05 17:51:56 +00:00
|
|
|
struct label *interpvnodelabel,
|
2002-11-08 18:04:00 +00:00
|
|
|
struct image_params *imgp, struct label *execlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_proc_create_swapper_t)(struct ucred *cred);
|
|
|
|
typedef void (*mpo_proc_create_init_t)(struct ucred *cred);
|
|
|
|
typedef void (*mpo_cred_relabel_t)(struct ucred *cred,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct label *newlabel);
|
2006-04-26 14:18:55 +00:00
|
|
|
typedef void (*mpo_thread_userret_t)(struct thread *thread);
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
2006-04-26 14:18:55 +00:00
|
|
|
/*
|
|
|
|
* Access control checks.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_bpfdesc_check_receive_t)(struct bpf_d *d,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *dlabel, struct ifnet *ifp,
|
|
|
|
struct label *ifplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_cred_check_relabel_t)(struct ucred *cred,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct label *newlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_cred_check_visible_t)(struct ucred *cr1,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct ucred *cr2);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_ifnet_check_relabel_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct ifnet *ifp, struct label *ifplabel,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct label *newlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_ifnet_check_transmit_t)(struct ifnet *ifp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *ifplabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_inpcb_check_deliver_t)(struct inpcb *inp,
|
Introduce a MAC label reference in 'struct inpcb', which caches
the MAC label referenced from 'struct socket' in the IPv4 and
IPv6-based protocols. This permits MAC labels to be checked during
network delivery operations without dereferencing inp->inp_socket
to get to so->so_label, which will eventually avoid our having to
grab the socket lock during delivery at the network layer.
This change introduces 'struct inpcb' as a labeled object to the
MAC Framework, along with the normal circus of entry points:
initialization, creation from socket, destruction, as well as a
delivery access control check.
For most policies, the inpcb label will simply be a cache of the
socket label, so a new protocol switch method is introduced,
pr_sosetlabel() to notify protocols that the socket layer label
has been updated so that the cache can be updated while holding
appropriate locks. Most protocols implement this using
pru_sosetlabel_null(), but IPv4/IPv6 protocols using inpcbs use
the the worker function in_pcbsosetlabel(), which calls into the
MAC Framework to perform a cache update.
Biba, LOMAC, and MLS implement these entry points, as do the stub
policy, and test policy.
Reviewed by: sam, bms
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2003-11-18 00:39:07 +00:00
|
|
|
struct label *inplabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvmsq_check_msgmsq_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msg *msgptr, struct label *msglabel,
|
|
|
|
struct msqid_kernel *msqkptr, struct label *msqklabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvmsq_check_msgrcv_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msg *msgptr, struct label *msglabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvmsq_check_msgrmid_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msg *msgptr, struct label *msglabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvmsq_check_msqget_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msqid_kernel *msqkptr, struct label *msqklabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvmsq_check_msqsnd_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msqid_kernel *msqkptr, struct label *msqklabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvmsq_check_msqrcv_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msqid_kernel *msqkptr, struct label *msqklabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvmsq_check_msqctl_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct msqid_kernel *msqkptr, struct label *msqklabel,
|
|
|
|
int cmd);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvsem_check_semctl_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct semid_kernel *semakptr, struct label *semaklabel,
|
|
|
|
int cmd);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvsem_check_semget_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct semid_kernel *semakptr, struct label *semaklabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvsem_check_semop_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct semid_kernel *semakptr, struct label *semaklabel,
|
|
|
|
size_t accesstype);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvshm_check_shmat_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct shmid_kernel *shmsegptr,
|
|
|
|
struct label *shmseglabel, int shmflg);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvshm_check_shmctl_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct shmid_kernel *shmsegptr,
|
|
|
|
struct label *shmseglabel, int cmd);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvshm_check_shmdt_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct shmid_kernel *shmsegptr,
|
|
|
|
struct label *shmseglabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_sysvshm_check_shmget_t)(struct ucred *cred,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
struct shmid_kernel *shmsegptr,
|
|
|
|
struct label *shmseglabel, int shmflg);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_kenv_check_dump_t)(struct ucred *cred);
|
|
|
|
typedef int (*mpo_kenv_check_get_t)(struct ucred *cred, char *name);
|
|
|
|
typedef int (*mpo_kenv_check_set_t)(struct ucred *cred, char *name,
|
2002-11-01 20:46:53 +00:00
|
|
|
char *value);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_kenv_check_unset_t)(struct ucred *cred, char *name);
|
|
|
|
typedef int (*mpo_kld_check_load_t)(struct ucred *cred, struct vnode *vp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_kld_check_stat_t)(struct ucred *cred);
|
2006-04-26 14:18:55 +00:00
|
|
|
typedef int (*mpo_mpo_placeholder19_t)(void);
|
|
|
|
typedef int (*mpo_mpo_placeholder20_t)(void);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_mount_check_stat_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct mount *mp, struct label *mplabel);
|
2006-04-26 14:18:55 +00:00
|
|
|
typedef int (*mpo_mpo_placeholder21_t)(void);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_pipe_check_ioctl_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct pipepair *pp, struct label *pplabel,
|
Define new MAC framework and policy entry points for System V IPC
objects and operations:
- System V IPC message, message queue, semaphore, and shared memory
segment init, destroy, cleanup, create operations.
- System V IPC message, message queue, seamphore, and shared memory
segment access control entry points, including rights to attach,
destroy, and manipulate these IPC objects.
Submitted by: Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Obtained from: TrustedBSD Project
Sponsored by: DARPA, SPAWAR, McAfee Research
2004-11-17 13:10:16 +00:00
|
|
|
unsigned long cmd, void *data);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_pipe_check_poll_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct pipepair *pp, struct label *pplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_pipe_check_read_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct pipepair *pp, struct label *pplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_pipe_check_relabel_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct pipepair *pp, struct label *pplabel,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct label *newlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_pipe_check_stat_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct pipepair *pp, struct label *pplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_pipe_check_write_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct pipepair *pp, struct label *pplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_posixsem_check_destroy_t)(struct ucred *cred,
|
2007-10-21 11:11:07 +00:00
|
|
|
struct ksem *ks, struct label *kslabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_posixsem_check_getvalue_t)(struct ucred *cred,
|
2007-10-21 11:11:07 +00:00
|
|
|
struct ksem *ks, struct label *kslabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_posixsem_check_open_t)(struct ucred *cred,
|
2007-10-21 11:11:07 +00:00
|
|
|
struct ksem *ks, struct label *kslabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_posixsem_check_post_t)(struct ucred *cred,
|
2007-10-21 11:11:07 +00:00
|
|
|
struct ksem *ks, struct label *kslabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_posixsem_check_unlink_t)(struct ucred *cred,
|
2007-10-21 11:11:07 +00:00
|
|
|
struct ksem *ks, struct label *kslabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_posixsem_check_wait_t)(struct ucred *cred,
|
2007-10-21 11:11:07 +00:00
|
|
|
struct ksem *ks, struct label *kslabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_debug_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct proc *p);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_sched_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct proc *p);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_setaudit_t)(struct ucred *cred,
|
2007-04-21 22:08:48 +00:00
|
|
|
struct auditinfo *ai);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_setaudit_addr_t)(struct ucred *cred,
|
2007-06-26 14:14:01 +00:00
|
|
|
struct auditinfo_addr *aia);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_setauid_t)(struct ucred *cred, uid_t auid);
|
|
|
|
typedef int (*mpo_proc_check_setuid_t)(struct ucred *cred, uid_t uid);
|
|
|
|
typedef int (*mpo_proc_check_seteuid_t)(struct ucred *cred, uid_t euid);
|
|
|
|
typedef int (*mpo_proc_check_setgid_t)(struct ucred *cred, gid_t gid);
|
|
|
|
typedef int (*mpo_proc_check_setegid_t)(struct ucred *cred, gid_t egid);
|
|
|
|
typedef int (*mpo_proc_check_setgroups_t)(struct ucred *cred, int ngroups,
|
2005-04-16 13:29:15 +00:00
|
|
|
gid_t *gidset);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_setreuid_t)(struct ucred *cred, uid_t ruid,
|
2005-04-16 13:29:15 +00:00
|
|
|
uid_t euid);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_setregid_t)(struct ucred *cred, gid_t rgid,
|
2005-04-16 13:29:15 +00:00
|
|
|
gid_t egid);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_setresuid_t)(struct ucred *cred, uid_t ruid,
|
2005-04-16 13:29:15 +00:00
|
|
|
uid_t euid, uid_t suid);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_setresgid_t)(struct ucred *cred, gid_t rgid,
|
2005-04-16 13:29:15 +00:00
|
|
|
gid_t egid, gid_t sgid);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_signal_t)(struct ucred *cred,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct proc *proc, int signum);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_proc_check_wait_t)(struct ucred *cred,
|
2005-04-18 13:36:57 +00:00
|
|
|
struct proc *proc);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_accept_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_bind_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel,
|
|
|
|
struct sockaddr *sa);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_connect_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel,
|
|
|
|
struct sockaddr *sa);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_create_t)(struct ucred *cred, int domain,
|
2005-07-05 22:49:10 +00:00
|
|
|
int type, int protocol);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_deliver_t)(struct socket *so,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *solabel, struct mbuf *m,
|
|
|
|
struct label *mlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_listen_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_poll_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_receive_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_relabel_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct label *newlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_send_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_stat_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_socket_check_visible_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct socket *so, struct label *solabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_system_check_acct_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_system_check_audit_t)(struct ucred *cred, void *record,
|
2007-04-21 22:08:48 +00:00
|
|
|
int length);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_system_check_auditctl_t)(struct ucred *cred,
|
2007-04-21 22:08:48 +00:00
|
|
|
struct vnode *vp, struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_system_check_auditon_t)(struct ucred *cred, int cmd);
|
|
|
|
typedef int (*mpo_system_check_reboot_t)(struct ucred *cred, int howto);
|
|
|
|
typedef int (*mpo_system_check_swapon_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_system_check_swapoff_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_system_check_sysctl_t)(struct ucred *cred,
|
2004-02-22 12:31:44 +00:00
|
|
|
struct sysctl_oid *oidp, void *arg1, int arg2,
|
|
|
|
struct sysctl_req *req);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_access_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel, int acc_mode);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_chdir_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_chroot_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_create_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct componentname *cnp, struct vattr *vap);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_deleteacl_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
|
|
|
acl_type_t type);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_deleteextattr_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
|
|
|
int attrnamespace, const char *name);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_exec_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
2006-04-26 14:18:55 +00:00
|
|
|
struct image_params *imgp, struct label *execlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_getacl_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
|
|
|
acl_type_t type);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_getextattr_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
|
|
|
int attrnamespace, const char *name, struct uio *uio);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_link_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel,
|
|
|
|
struct vnode *vp, struct label *vplabel,
|
|
|
|
struct componentname *cnp);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_listextattr_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
2006-04-26 14:18:55 +00:00
|
|
|
int attrnamespace);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_lookup_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct componentname *cnp);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_mmap_t)(struct ucred *cred,
|
2006-04-26 14:18:55 +00:00
|
|
|
struct vnode *vp, struct label *label, int prot,
|
|
|
|
int flags);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef void (*mpo_vnode_check_mmap_downgrade_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel, int *prot);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_mprotect_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel, int prot);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_open_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel, int acc_mode);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_poll_t)(struct ucred *active_cred,
|
2002-08-19 19:04:53 +00:00
|
|
|
struct ucred *file_cred, struct vnode *vp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_read_t)(struct ucred *active_cred,
|
2002-08-19 19:04:53 +00:00
|
|
|
struct ucred *file_cred, struct vnode *vp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_readdir_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_readlink_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_relabel_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct label *newlabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_rename_from_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel,
|
|
|
|
struct vnode *vp, struct label *vplabel,
|
2006-04-26 14:18:55 +00:00
|
|
|
struct componentname *cnp);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_rename_to_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel,
|
|
|
|
struct vnode *vp, struct label *vplabel, int samedir,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct componentname *cnp);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_revoke_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_setacl_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel, acl_type_t type,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct acl *acl);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_setextattr_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
|
|
|
int attrnamespace, const char *name, struct uio *uio);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_setflags_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel, u_long flags);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_setmode_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel, mode_t mode);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_setowner_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel, uid_t uid,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
gid_t gid);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_setutimes_t)(struct ucred *cred,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct vnode *vp, struct label *vplabel,
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct timespec atime, struct timespec mtime);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_stat_t)(struct ucred *active_cred,
|
2002-08-19 19:04:53 +00:00
|
|
|
struct ucred *file_cred, struct vnode *vp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *vplabel);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_unlink_t)(struct ucred *cred,
|
2007-09-10 00:00:18 +00:00
|
|
|
struct vnode *dvp, struct label *dvplabel,
|
|
|
|
struct vnode *vp, struct label *vplabel,
|
|
|
|
struct componentname *cnp);
|
2007-10-24 19:04:04 +00:00
|
|
|
typedef int (*mpo_vnode_check_write_t)(struct ucred *active_cred,
|
2002-08-19 19:04:53 +00:00
|
|
|
struct ucred *file_cred, struct vnode *vp,
|
2007-04-22 19:55:56 +00:00
|
|
|
struct label *vplabel);
|
2006-08-06 16:56:15 +00:00
|
|
|
typedef void (*mpo_associate_nfsd_label_t)(struct ucred *cred);
|
2006-11-06 13:42:10 +00:00
|
|
|
typedef int (*mpo_priv_check_t)(struct ucred *cred, int priv);
|
|
|
|
typedef int (*mpo_priv_grant_t)(struct ucred *cred, int priv);
|
2006-04-26 14:18:55 +00:00
|
|
|
|
|
|
|
struct mac_policy_ops {
|
|
|
|
/*
|
|
|
|
* Policy module operations.
|
|
|
|
*/
|
|
|
|
mpo_destroy_t mpo_destroy;
|
|
|
|
mpo_init_t mpo_init;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* General policy-directed security system call so that policies may
|
|
|
|
* implement new services without reserving explicit system call
|
|
|
|
* numbers.
|
|
|
|
*/
|
|
|
|
mpo_syscall_t mpo_syscall;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_bpfdesc_init_label_t mpo_bpfdesc_init_label;
|
|
|
|
mpo_cred_init_label_t mpo_cred_init_label;
|
|
|
|
mpo_devfs_init_label_t mpo_devfs_init_label;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder0;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_ifnet_init_label_t mpo_ifnet_init_label;
|
|
|
|
mpo_inpcb_init_label_t mpo_inpcb_init_label;
|
|
|
|
mpo_sysvmsg_init_label_t mpo_sysvmsg_init_label;
|
|
|
|
mpo_sysvmsq_init_label_t mpo_sysvmsq_init_label;
|
|
|
|
mpo_sysvsem_init_label_t mpo_sysvsem_init_label;
|
|
|
|
mpo_sysvshm_init_label_t mpo_sysvshm_init_label;
|
|
|
|
mpo_ipq_init_label_t mpo_ipq_init_label;
|
|
|
|
mpo_mbuf_init_label_t mpo_mbuf_init_label;
|
|
|
|
mpo_mount_init_label_t mpo_mount_init_label;
|
|
|
|
mpo_socket_init_label_t mpo_socket_init_label;
|
|
|
|
mpo_socketpeer_init_label_t mpo_socketpeer_init_label;
|
|
|
|
mpo_pipe_init_label_t mpo_pipe_init_label;
|
|
|
|
mpo_posixsem_init_label_t mpo_posixsem_init_label;
|
|
|
|
mpo_proc_init_label_t mpo_proc_init_label;
|
|
|
|
mpo_vnode_init_label_t mpo_vnode_init_label;
|
|
|
|
mpo_bpfdesc_destroy_label_t mpo_bpfdesc_destroy_label;
|
|
|
|
mpo_cred_destroy_label_t mpo_cred_destroy_label;
|
|
|
|
mpo_devfs_destroy_label_t mpo_devfs_destroy_label;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder1;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_ifnet_destroy_label_t mpo_ifnet_destroy_label;
|
|
|
|
mpo_inpcb_destroy_label_t mpo_inpcb_destroy_label;
|
|
|
|
mpo_sysvmsg_destroy_label_t mpo_sysvmsg_destroy_label;
|
|
|
|
mpo_sysvmsq_destroy_label_t mpo_sysvmsq_destroy_label;
|
|
|
|
mpo_sysvsem_destroy_label_t mpo_sysvsem_destroy_label;
|
|
|
|
mpo_sysvshm_destroy_label_t mpo_sysvshm_destroy_label;
|
|
|
|
mpo_ipq_destroy_label_t mpo_ipq_destroy_label;
|
|
|
|
mpo_mbuf_destroy_label_t mpo_mbuf_destroy_label;
|
|
|
|
mpo_mount_destroy_label_t mpo_mount_destroy_label;
|
|
|
|
mpo_socket_destroy_label_t mpo_socket_destroy_label;
|
|
|
|
mpo_socketpeer_destroy_label_t mpo_socketpeer_destroy_label;
|
|
|
|
mpo_pipe_destroy_label_t mpo_pipe_destroy_label;
|
|
|
|
mpo_posixsem_destroy_label_t mpo_posixsem_destroy_label;
|
|
|
|
mpo_proc_destroy_label_t mpo_proc_destroy_label;
|
|
|
|
mpo_vnode_destroy_label_t mpo_vnode_destroy_label;
|
|
|
|
mpo_sysvmsg_cleanup_t mpo_sysvmsg_cleanup;
|
|
|
|
mpo_sysvmsq_cleanup_t mpo_sysvmsq_cleanup;
|
|
|
|
mpo_sysvsem_cleanup_t mpo_sysvsem_cleanup;
|
|
|
|
mpo_sysvshm_cleanup_t mpo_sysvshm_cleanup;
|
|
|
|
mpo_cred_copy_label_t mpo_cred_copy_label;
|
|
|
|
mpo_ifnet_copy_label_t mpo_ifnet_copy_label;
|
|
|
|
mpo_mbuf_copy_label_t mpo_mbuf_copy_label;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder2;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_pipe_copy_label_t mpo_pipe_copy_label;
|
|
|
|
mpo_socket_copy_label_t mpo_socket_copy_label;
|
|
|
|
mpo_vnode_copy_label_t mpo_vnode_copy_label;
|
|
|
|
mpo_cred_externalize_label_t mpo_cred_externalize_label;
|
|
|
|
mpo_ifnet_externalize_label_t mpo_ifnet_externalize_label;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder3;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_pipe_externalize_label_t mpo_pipe_externalize_label;
|
|
|
|
mpo_socket_externalize_label_t mpo_socket_externalize_label;
|
|
|
|
mpo_socketpeer_externalize_label_t mpo_socketpeer_externalize_label;
|
|
|
|
mpo_vnode_externalize_label_t mpo_vnode_externalize_label;
|
|
|
|
mpo_cred_internalize_label_t mpo_cred_internalize_label;
|
|
|
|
mpo_ifnet_internalize_label_t mpo_ifnet_internalize_label;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder4;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_pipe_internalize_label_t mpo_pipe_internalize_label;
|
|
|
|
mpo_socket_internalize_label_t mpo_socket_internalize_label;
|
|
|
|
mpo_vnode_internalize_label_t mpo_vnode_internalize_label;
|
2006-04-26 14:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Labeling event operations: file system objects, and things that
|
|
|
|
* look a lot like file system objects.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_devfs_vnode_associate_t mpo_devfs_vnode_associate;
|
|
|
|
mpo_vnode_associate_extattr_t mpo_vnode_associate_extattr;
|
|
|
|
mpo_vnode_associate_singlelabel_t mpo_vnode_associate_singlelabel;
|
|
|
|
mpo_devfs_create_device_t mpo_devfs_create_device;
|
|
|
|
mpo_devfs_create_directory_t mpo_devfs_create_directory;
|
|
|
|
mpo_devfs_create_symlink_t mpo_devfs_create_symlink;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder5;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_vnode_create_extattr_t mpo_vnode_create_extattr;
|
|
|
|
mpo_mount_create_t mpo_mount_create;
|
|
|
|
mpo_vnode_relabel_t mpo_vnode_relabel;
|
|
|
|
mpo_vnode_setlabel_extattr_t mpo_vnode_setlabel_extattr;
|
|
|
|
mpo_devfs_update_t mpo_devfs_update;
|
2006-04-26 14:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Labeling event operations: IPC objects.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_socket_create_mbuf_t mpo_socket_create_mbuf;
|
|
|
|
mpo_socket_create_t mpo_socket_create;
|
|
|
|
mpo_socket_newconn_t mpo_socket_newconn;
|
|
|
|
mpo_socket_relabel_t mpo_socket_relabel;
|
|
|
|
mpo_pipe_relabel_t mpo_pipe_relabel;
|
|
|
|
mpo_socketpeer_set_from_mbuf_t mpo_socketpeer_set_from_mbuf;
|
|
|
|
mpo_socketpeer_set_from_socket_t mpo_socketpeer_set_from_socket;
|
|
|
|
mpo_pipe_create_t mpo_pipe_create;
|
2006-04-26 14:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Labeling event operations: System V IPC primitives.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_sysvmsg_create_t mpo_sysvmsg_create;
|
|
|
|
mpo_sysvmsq_create_t mpo_sysvmsq_create;
|
|
|
|
mpo_sysvsem_create_t mpo_sysvsem_create;
|
|
|
|
mpo_sysvshm_create_t mpo_sysvshm_create;
|
2006-04-26 14:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Labeling event operations: POSIX (global/inter-process) semaphores.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_posixsem_create_t mpo_posixsem_create;
|
2006-04-26 14:18:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Labeling event operations: network objects.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_bpfdesc_create_t mpo_bpfdesc_create;
|
|
|
|
mpo_ifnet_create_t mpo_ifnet_create;
|
|
|
|
mpo_inpcb_create_t mpo_inpcb_create;
|
|
|
|
mpo_ipq_create_t mpo_ipq_create;
|
|
|
|
mpo_ipq_reassemble mpo_ipq_reassemble;
|
|
|
|
mpo_netinet_fragment_t mpo_netinet_fragment;
|
|
|
|
mpo_inpcb_create_mbuf_t mpo_inpcb_create_mbuf;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_create_mbuf_linklayer_t mpo_create_mbuf_linklayer;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_bpfdesc_create_mbuf_t mpo_bpfdesc_create_mbuf;
|
|
|
|
mpo_ifnet_create_mbuf_t mpo_ifnet_create_mbuf;
|
|
|
|
mpo_mbuf_create_multicast_encap_t mpo_mbuf_create_multicast_encap;
|
|
|
|
mpo_mbuf_create_netlayer_t mpo_mbuf_create_netlayer;
|
|
|
|
mpo_ipq_match_t mpo_ipq_match;
|
|
|
|
mpo_netinet_icmp_reply_t mpo_netinet_icmp_reply;
|
|
|
|
mpo_netinet_tcp_reply_t mpo_netinet_tcp_reply;
|
|
|
|
mpo_ifnet_relabel_t mpo_ifnet_relabel;
|
|
|
|
mpo_ipq_update_t mpo_ipq_update;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_inpcb_sosetlabel_t mpo_inpcb_sosetlabel;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Labeling event operations: processes.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_vnode_execve_transition_t mpo_vnode_execve_transition;
|
|
|
|
mpo_vnode_execve_will_transition_t mpo_vnode_execve_will_transition;
|
|
|
|
mpo_proc_create_swapper_t mpo_proc_create_swapper;
|
|
|
|
mpo_proc_create_init_t mpo_proc_create_init;
|
|
|
|
mpo_cred_relabel_t mpo_cred_relabel;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder6;
|
|
|
|
mpo_thread_userret_t mpo_thread_userret;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Access control checks.
|
|
|
|
*/
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_bpfdesc_check_receive_t mpo_bpfdesc_check_receive;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder7;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_cred_check_relabel_t mpo_cred_check_relabel;
|
|
|
|
mpo_cred_check_visible_t mpo_cred_check_visible;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder8;
|
|
|
|
mpo_placeholder_t _mpo_placeholder9;
|
|
|
|
mpo_placeholder_t _mpo_placeholder10;
|
|
|
|
mpo_placeholder_t _mpo_placeholder11;
|
|
|
|
mpo_placeholder_t _mpo_placeholder12;
|
|
|
|
mpo_placeholder_t _mpo_placeholder13;
|
|
|
|
mpo_placeholder_t _mpo_placeholder14;
|
|
|
|
mpo_placeholder_t _mpo_placeholder15;
|
|
|
|
mpo_placeholder_t _mpo_placeholder16;
|
|
|
|
mpo_placeholder_t _mpo_placeholder17;
|
|
|
|
mpo_placeholder_t _mpo_placeholder18;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_ifnet_check_relabel_t mpo_ifnet_check_relabel;
|
|
|
|
mpo_ifnet_check_transmit_t mpo_ifnet_check_transmit;
|
|
|
|
mpo_inpcb_check_deliver_t mpo_inpcb_check_deliver;
|
|
|
|
mpo_sysvmsq_check_msgmsq_t mpo_sysvmsq_check_msgmsq;
|
|
|
|
mpo_sysvmsq_check_msgrcv_t mpo_sysvmsq_check_msgrcv;
|
|
|
|
mpo_sysvmsq_check_msgrmid_t mpo_sysvmsq_check_msgrmid;
|
|
|
|
mpo_sysvmsq_check_msqget_t mpo_sysvmsq_check_msqget;
|
|
|
|
mpo_sysvmsq_check_msqsnd_t mpo_sysvmsq_check_msqsnd;
|
|
|
|
mpo_sysvmsq_check_msqrcv_t mpo_sysvmsq_check_msqrcv;
|
|
|
|
mpo_sysvmsq_check_msqctl_t mpo_sysvmsq_check_msqctl;
|
|
|
|
mpo_sysvsem_check_semctl_t mpo_sysvsem_check_semctl;
|
|
|
|
mpo_sysvsem_check_semget_t mpo_sysvsem_check_semget;
|
|
|
|
mpo_sysvsem_check_semop_t mpo_sysvsem_check_semop;
|
|
|
|
mpo_sysvshm_check_shmat_t mpo_sysvshm_check_shmat;
|
|
|
|
mpo_sysvshm_check_shmctl_t mpo_sysvshm_check_shmctl;
|
|
|
|
mpo_sysvshm_check_shmdt_t mpo_sysvshm_check_shmdt;
|
|
|
|
mpo_sysvshm_check_shmget_t mpo_sysvshm_check_shmget;
|
|
|
|
mpo_kenv_check_dump_t mpo_kenv_check_dump;
|
|
|
|
mpo_kenv_check_get_t mpo_kenv_check_get;
|
|
|
|
mpo_kenv_check_set_t mpo_kenv_check_set;
|
|
|
|
mpo_kenv_check_unset_t mpo_kenv_check_unset;
|
|
|
|
mpo_kld_check_load_t mpo_kld_check_load;
|
|
|
|
mpo_kld_check_stat_t mpo_kld_check_stat;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder19;
|
|
|
|
mpo_placeholder_t _mpo_placeholder20;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_mount_check_stat_t mpo_mount_check_stat;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder_21;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_pipe_check_ioctl_t mpo_pipe_check_ioctl;
|
|
|
|
mpo_pipe_check_poll_t mpo_pipe_check_poll;
|
|
|
|
mpo_pipe_check_read_t mpo_pipe_check_read;
|
|
|
|
mpo_pipe_check_relabel_t mpo_pipe_check_relabel;
|
|
|
|
mpo_pipe_check_stat_t mpo_pipe_check_stat;
|
|
|
|
mpo_pipe_check_write_t mpo_pipe_check_write;
|
|
|
|
mpo_posixsem_check_destroy_t mpo_posixsem_check_destroy;
|
|
|
|
mpo_posixsem_check_getvalue_t mpo_posixsem_check_getvalue;
|
|
|
|
mpo_posixsem_check_open_t mpo_posixsem_check_open;
|
|
|
|
mpo_posixsem_check_post_t mpo_posixsem_check_post;
|
|
|
|
mpo_posixsem_check_unlink_t mpo_posixsem_check_unlink;
|
|
|
|
mpo_posixsem_check_wait_t mpo_posixsem_check_wait;
|
|
|
|
mpo_proc_check_debug_t mpo_proc_check_debug;
|
|
|
|
mpo_proc_check_sched_t mpo_proc_check_sched;
|
|
|
|
mpo_proc_check_setaudit_t mpo_proc_check_setaudit;
|
|
|
|
mpo_proc_check_setaudit_addr_t mpo_proc_check_setaudit_addr;
|
|
|
|
mpo_proc_check_setauid_t mpo_proc_check_setauid;
|
|
|
|
mpo_proc_check_setuid_t mpo_proc_check_setuid;
|
|
|
|
mpo_proc_check_seteuid_t mpo_proc_check_seteuid;
|
|
|
|
mpo_proc_check_setgid_t mpo_proc_check_setgid;
|
|
|
|
mpo_proc_check_setegid_t mpo_proc_check_setegid;
|
|
|
|
mpo_proc_check_setgroups_t mpo_proc_check_setgroups;
|
|
|
|
mpo_proc_check_setreuid_t mpo_proc_check_setreuid;
|
|
|
|
mpo_proc_check_setregid_t mpo_proc_check_setregid;
|
|
|
|
mpo_proc_check_setresuid_t mpo_proc_check_setresuid;
|
|
|
|
mpo_proc_check_setresgid_t mpo_proc_check_setresgid;
|
|
|
|
mpo_proc_check_signal_t mpo_proc_check_signal;
|
|
|
|
mpo_proc_check_wait_t mpo_proc_check_wait;
|
|
|
|
mpo_socket_check_accept_t mpo_socket_check_accept;
|
|
|
|
mpo_socket_check_bind_t mpo_socket_check_bind;
|
|
|
|
mpo_socket_check_connect_t mpo_socket_check_connect;
|
|
|
|
mpo_socket_check_create_t mpo_socket_check_create;
|
|
|
|
mpo_socket_check_deliver_t mpo_socket_check_deliver;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder22;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_socket_check_listen_t mpo_socket_check_listen;
|
|
|
|
mpo_socket_check_poll_t mpo_socket_check_poll;
|
|
|
|
mpo_socket_check_receive_t mpo_socket_check_receive;
|
|
|
|
mpo_socket_check_relabel_t mpo_socket_check_relabel;
|
|
|
|
mpo_socket_check_send_t mpo_socket_check_send;
|
|
|
|
mpo_socket_check_stat_t mpo_socket_check_stat;
|
|
|
|
mpo_socket_check_visible_t mpo_socket_check_visible;
|
|
|
|
mpo_system_check_acct_t mpo_system_check_acct;
|
|
|
|
mpo_system_check_audit_t mpo_system_check_audit;
|
|
|
|
mpo_system_check_auditctl_t mpo_system_check_auditctl;
|
|
|
|
mpo_system_check_auditon_t mpo_system_check_auditon;
|
|
|
|
mpo_system_check_reboot_t mpo_system_check_reboot;
|
|
|
|
mpo_system_check_swapon_t mpo_system_check_swapon;
|
|
|
|
mpo_system_check_swapoff_t mpo_system_check_swapoff;
|
|
|
|
mpo_system_check_sysctl_t mpo_system_check_sysctl;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder23;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_vnode_check_access_t mpo_vnode_check_access;
|
|
|
|
mpo_vnode_check_chdir_t mpo_vnode_check_chdir;
|
|
|
|
mpo_vnode_check_chroot_t mpo_vnode_check_chroot;
|
|
|
|
mpo_vnode_check_create_t mpo_vnode_check_create;
|
|
|
|
mpo_vnode_check_deleteacl_t mpo_vnode_check_deleteacl;
|
|
|
|
mpo_vnode_check_deleteextattr_t mpo_vnode_check_deleteextattr;
|
|
|
|
mpo_vnode_check_exec_t mpo_vnode_check_exec;
|
|
|
|
mpo_vnode_check_getacl_t mpo_vnode_check_getacl;
|
|
|
|
mpo_vnode_check_getextattr_t mpo_vnode_check_getextattr;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_placeholder_t _mpo_placeholder24;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_vnode_check_link_t mpo_vnode_check_link;
|
|
|
|
mpo_vnode_check_listextattr_t mpo_vnode_check_listextattr;
|
|
|
|
mpo_vnode_check_lookup_t mpo_vnode_check_lookup;
|
|
|
|
mpo_vnode_check_mmap_t mpo_vnode_check_mmap;
|
|
|
|
mpo_vnode_check_mmap_downgrade_t mpo_vnode_check_mmap_downgrade;
|
|
|
|
mpo_vnode_check_mprotect_t mpo_vnode_check_mprotect;
|
|
|
|
mpo_vnode_check_open_t mpo_vnode_check_open;
|
|
|
|
mpo_vnode_check_poll_t mpo_vnode_check_poll;
|
|
|
|
mpo_vnode_check_read_t mpo_vnode_check_read;
|
|
|
|
mpo_vnode_check_readdir_t mpo_vnode_check_readdir;
|
|
|
|
mpo_vnode_check_readlink_t mpo_vnode_check_readlink;
|
|
|
|
mpo_vnode_check_relabel_t mpo_vnode_check_relabel;
|
|
|
|
mpo_vnode_check_rename_from_t mpo_vnode_check_rename_from;
|
|
|
|
mpo_vnode_check_rename_to_t mpo_vnode_check_rename_to;
|
|
|
|
mpo_vnode_check_revoke_t mpo_vnode_check_revoke;
|
|
|
|
mpo_vnode_check_setacl_t mpo_vnode_check_setacl;
|
|
|
|
mpo_vnode_check_setextattr_t mpo_vnode_check_setextattr;
|
|
|
|
mpo_vnode_check_setflags_t mpo_vnode_check_setflags;
|
|
|
|
mpo_vnode_check_setmode_t mpo_vnode_check_setmode;
|
|
|
|
mpo_vnode_check_setowner_t mpo_vnode_check_setowner;
|
|
|
|
mpo_vnode_check_setutimes_t mpo_vnode_check_setutimes;
|
|
|
|
mpo_vnode_check_stat_t mpo_vnode_check_stat;
|
|
|
|
mpo_vnode_check_unlink_t mpo_vnode_check_unlink;
|
|
|
|
mpo_vnode_check_write_t mpo_vnode_check_write;
|
2006-04-26 14:18:55 +00:00
|
|
|
mpo_associate_nfsd_label_t mpo_associate_nfsd_label;
|
2007-10-24 19:04:04 +00:00
|
|
|
mpo_mbuf_create_from_firewall_t mpo_mbuf_create_from_firewall;
|
2006-12-13 06:00:57 +00:00
|
|
|
mpo_init_syncache_label_t mpo_init_syncache_label;
|
|
|
|
mpo_destroy_syncache_label_t mpo_destroy_syncache_label;
|
|
|
|
mpo_init_syncache_from_inpcb_t mpo_init_syncache_from_inpcb;
|
|
|
|
mpo_create_mbuf_from_syncache_t mpo_create_mbuf_from_syncache;
|
2006-11-06 13:42:10 +00:00
|
|
|
mpo_priv_check_t mpo_priv_check;
|
|
|
|
mpo_priv_grant_t mpo_priv_grant;
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
};
|
|
|
|
|
2004-10-22 11:29:30 +00:00
|
|
|
/*
|
|
|
|
* struct mac_policy_conf is the registration structure for policies, and is
|
|
|
|
* provided to the MAC Framework using MAC_POLICY_SET() to invoke a SYSINIT
|
|
|
|
* to register the policy. In general, the fields are immutable, with the
|
|
|
|
* exception of the "security field", run-time flags, and policy list entry,
|
|
|
|
* which are managed by the MAC Framework. Be careful when modifying this
|
|
|
|
* structure, as its layout is statically compiled into all policies.
|
|
|
|
*/
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
struct mac_policy_conf {
|
|
|
|
char *mpc_name; /* policy name */
|
|
|
|
char *mpc_fullname; /* policy full name */
|
|
|
|
struct mac_policy_ops *mpc_ops; /* policy operations */
|
|
|
|
int mpc_loadtime_flags; /* flags */
|
|
|
|
int *mpc_field_off; /* security field */
|
|
|
|
int mpc_runtime_flags; /* flags */
|
|
|
|
LIST_ENTRY(mac_policy_conf) mpc_list; /* global list */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Flags for the mpc_loadtime_flags field. */
|
|
|
|
#define MPC_LOADTIME_FLAG_NOTLATE 0x00000001
|
|
|
|
#define MPC_LOADTIME_FLAG_UNLOADOK 0x00000002
|
Move MAC label storage for mbufs into m_tags from the m_pkthdr structure,
returning some additional room in the first mbuf in a chain, and
avoiding feature-specific contents in the mbuf header. To do this:
- Modify mbuf_to_label() to extract the tag, returning NULL if not
found.
- Introduce mac_init_mbuf_tag() which does most of the work
mac_init_mbuf() used to do, except on an m_tag rather than an
mbuf.
- Scale back mac_init_mbuf() to perform m_tag allocation and invoke
mac_init_mbuf_tag().
- Replace mac_destroy_mbuf() with mac_destroy_mbuf_tag(), since
m_tag's are now GC'd deep in the m_tag/mbuf code rather than
at a higher level when mbufs are directly free()'d.
- Add mac_copy_mbuf_tag() to support m_copy_pkthdr() and related
notions.
- Generally change all references to mbuf labels so that they use
mbuf_to_label() rather than &mbuf->m_pkthdr.label. This
required no changes in the MAC policies (yay!).
- Tweak mbuf release routines to not call mac_destroy_mbuf(),
tag destruction takes care of it for us now.
- Remove MAC magic from m_copy_pkthdr() and m_move_pkthdr() --
the existing m_tag support does all this for us. Note that
we can no longer just zero the m_tag list on the target mbuf,
rather, we have to delete the chain because m_tag's will
already be hung off freshly allocated mbuf's.
- Tweak m_tag copying routines so that if we're copying a MAC
m_tag, we don't do a binary copy, rather, we initialize the
new storage and do a deep copy of the label.
- Remove use of MAC_FLAG_INITIALIZED in a few bizarre places
having to do with mbuf header copies previously.
- When an mbuf is copied in ip_input(), we no longer need to
explicitly copy the label because it will get handled by the
m_tag code now.
- No longer any weird handling of MAC labels in if_loop.c during
header copies.
- Add MPC_LOADTIME_FLAG_LABELMBUFS flag to Biba, MLS, mac_test.
In mac_test, handle the label==NULL case, since it can be
dynamically loaded.
In order to improve performance with this change, introduce the notion
of "lazy MAC label allocation" -- only allocate m_tag storage for MAC
labels if we're running with a policy that uses MAC labels on mbufs.
Policies declare this intent by setting the MPC_LOADTIME_FLAG_LABELMBUFS
flag in their load-time flags field during declaration. Note: this
opens up the possibility of post-boot policy modules getting back NULL
slot entries even though they have policy invariants of non-NULL slot
entries, as the policy might have been loaded after the mbuf was
allocated, leaving the mbuf without label storage. Policies that cannot
handle this case must be declared as NOTLATE, or must be modified.
- mac_labelmbufs holds the current cumulative status as to whether
any policies require mbuf labeling or not. This is updated whenever
the active policy set changes by the function mac_policy_updateflags().
The function iterates the list and checks whether any have the
flag set. Write access to this variable is protected by the policy
list; read access is currently not protected for performance reasons.
This might change if it causes problems.
- Add MAC_POLICY_LIST_ASSERT_EXCLUSIVE() to permit the flags update
function to assert appropriate locks.
- This makes allocation in mac_init_mbuf() conditional on the flag.
Reviewed by: sam
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2003-04-14 20:39:06 +00:00
|
|
|
#define MPC_LOADTIME_FLAG_LABELMBUFS 0x00000004
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
|
|
|
/* Flags for the mpc_runtime_flags field. */
|
|
|
|
#define MPC_RUNTIME_FLAG_REGISTERED 0x00000001
|
|
|
|
|
2006-12-28 21:48:38 +00:00
|
|
|
/*-
|
|
|
|
* The TrustedBSD MAC Framework has a major version number, MAC_VERSION,
|
|
|
|
* which defines the ABI of the Framework present in the kernel (and depended
|
|
|
|
* on by policy modules compiled against that kernel). Currently,
|
|
|
|
* MAC_POLICY_SET() requires that the kernel and module ABI version numbers
|
|
|
|
* exactly match. The following major versions have been defined to date:
|
|
|
|
*
|
|
|
|
* MAC version FreeBSD versions
|
|
|
|
* 1 5.x
|
|
|
|
* 2 6.x
|
|
|
|
* 3 7.x
|
2007-10-23 14:12:16 +00:00
|
|
|
* 4 8.x
|
2006-12-28 21:48:38 +00:00
|
|
|
*/
|
2007-10-23 14:12:16 +00:00
|
|
|
#define MAC_VERSION 4
|
2006-12-28 21:48:38 +00:00
|
|
|
|
Move to C99 sparse structure initialization for the mac_policy_ops
structure definition, rather than using an operation vector
we translate into the structure. Originally, we used a vector
for two reasons:
(1) We wanted to define the structure sparsely, which wasn't
supported by the C compiler for structures. For a policy
with five entry points, you don't want to have to stick in
a few hundred NULL function pointers.
(2) We thought it would improve ABI compatibility allowing modules
to work with kernels that had a superset of the entry points
defined in the module, even if the kernel had changed its
entry point set.
Both of these no longer apply:
(1) C99 gives us a way to sparsely define a static structure.
(2) The ABI problems existed anyway, due to enumeration numbers,
argument changes, and semantic mismatches. Since the going
rule for FreeBSD is that you really need your modules to
pretty closely match your kernel, it's not worth the
complexity.
This submit eliminates the operation vector, dynamic allocation
of the operation structure, copying of the vector to the
structure, and redoes the vectors in each policy to direct
structure definitions. One enourmous benefit of this change
is that we now get decent type checking on policy entry point
implementation arguments.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-30 18:48:51 +00:00
|
|
|
#define MAC_POLICY_SET(mpops, mpname, mpfullname, mpflags, privdata_wanted) \
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
static struct mac_policy_conf mpname##_mac_policy_conf = { \
|
|
|
|
#mpname, \
|
|
|
|
mpfullname, \
|
Move to C99 sparse structure initialization for the mac_policy_ops
structure definition, rather than using an operation vector
we translate into the structure. Originally, we used a vector
for two reasons:
(1) We wanted to define the structure sparsely, which wasn't
supported by the C compiler for structures. For a policy
with five entry points, you don't want to have to stick in
a few hundred NULL function pointers.
(2) We thought it would improve ABI compatibility allowing modules
to work with kernels that had a superset of the entry points
defined in the module, even if the kernel had changed its
entry point set.
Both of these no longer apply:
(1) C99 gives us a way to sparsely define a static structure.
(2) The ABI problems existed anyway, due to enumeration numbers,
argument changes, and semantic mismatches. Since the going
rule for FreeBSD is that you really need your modules to
pretty closely match your kernel, it's not worth the
complexity.
This submit eliminates the operation vector, dynamic allocation
of the operation structure, copying of the vector to the
structure, and redoes the vectors in each policy to direct
structure definitions. One enourmous benefit of this change
is that we now get decent type checking on policy entry point
implementation arguments.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2002-10-30 18:48:51 +00:00
|
|
|
mpops, \
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
mpflags, \
|
|
|
|
privdata_wanted, \
|
|
|
|
0, \
|
|
|
|
}; \
|
|
|
|
static moduledata_t mpname##_mod = { \
|
|
|
|
#mpname, \
|
|
|
|
mac_policy_modevent, \
|
|
|
|
&mpname##_mac_policy_conf \
|
|
|
|
}; \
|
2006-12-28 21:48:38 +00:00
|
|
|
MODULE_DEPEND(mpname, kernel_mac_support, MAC_VERSION, \
|
|
|
|
MAC_VERSION, MAC_VERSION); \
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
DECLARE_MODULE(mpname, mpname##_mod, SI_SUB_MAC_POLICY, \
|
|
|
|
SI_ORDER_MIDDLE)
|
|
|
|
|
|
|
|
int mac_policy_modevent(module_t mod, int type, void *data);
|
|
|
|
|
2006-12-20 23:41:59 +00:00
|
|
|
/*
|
|
|
|
* Policy interface to map a struct label pointer to per-policy data.
|
|
|
|
* Typically, policies wrap this in their own accessor macro that casts a
|
2007-02-06 14:19:25 +00:00
|
|
|
* uintptr_t to a policy-specific data type.
|
2006-12-20 23:41:59 +00:00
|
|
|
*/
|
2007-02-06 14:19:25 +00:00
|
|
|
intptr_t mac_label_get(struct label *l, int slot);
|
|
|
|
void mac_label_set(struct label *l, int slot, intptr_t v);
|
Begin committing support for Mandatory Access Control and extensible
kernel access control. The MAC framework permits loadable kernel
modules to link to the kernel at compile-time, boot-time, or run-time,
and augment the system security policy. This commit includes the
initial kernel implementation, although the interface with the userland
components of the oeprating system is still under work, and not all
kernel subsystems are supported. Later in this commit sequence,
documentation of which kernel subsystems will not work correctly with
a kernel compiled with MAC support will be added.
Include files to declare MAC userland interface (mac.h), MAC subsystem
entry points (mac.h), and MAC policy entry points (mac_policy.h). These
files define the interface between the kernel and the MAC framework,
and between the MAC framework and each registered policy module. These
APIs and ABIs may not be assumed to be stable until following FreeBSD
5.1-RELEASE.
Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs
2002-07-30 21:32:34 +00:00
|
|
|
|
2006-12-28 23:23:35 +00:00
|
|
|
#endif /* !_SYS_SECURITY_MAC_MAC_POLICY_H_ */
|