freebsd-nq/sys/security
Robert Watson 41a17fe326 Clean up locking for the MAC Framework:
(1) Accept that we're now going to use mutexes, so don't attempt
    to avoid treating them as mutexes.  This cleans up locking
    accessor function names some.

(2) Rename variables to _mtx, _cv, _count, simplifying the naming.

(3) Add a new form of the _busy() primitive that conditionally
    makes the list busy: if there are entries on the list, bump
    the busy count.  If there are no entries, don't bump the busy
    count.  Return a boolean indicating whether or not the busy
    count was bumped.

(4) Break mac_policy_list into two lists: one with the same name
    holding dynamic policies, and a new list, mac_static_policy_list,
    which holds policies loaded before mac_late and without the
    unload flag set.  The static list may be accessed without
    holding the busy count, since it can't change at run-time.

(5) In general, prefer making the list busy conditionally, meaning
    we pay only one mutex lock per entry point if all modules are
    on the static list, rather than two (since we don't have to
    lower the busy count when we're done with the framework).  For
    systems running just Biba or MLS, this will halve the mutex
    accesses in the network stack, and may offer a substantial
    performance benefits.

(6) Lay the groundwork for a dynamic-free kernel option which
    eliminates all locking associated with dynamically loaded or
    unloaded policies, for pre-configured systems requiring
    maximum performance but less run-time flexibility.

These changes have been running for a few weeks on MAC development
branch systems.

Approved by:	re (jhb)
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-05-07 17:49:24 +00:00
..
mac Clean up locking for the MAC Framework: 2003-05-07 17:49:24 +00:00
mac_biba Enable the MAC_ALWAYS_LABEL_MBUF flag for the Biba, LOMAC, MLS, and Test 2003-04-15 20:51:18 +00:00
mac_bsdextended Trim "trustedbsd_" from the front of the policy module "short names"; 2003-03-27 19:26:39 +00:00
mac_ifoff Rather than check for M_PKTHDR and conditionally perform access control, 2003-04-18 20:22:23 +00:00
mac_lomac Enable the MAC_ALWAYS_LABEL_MBUF flag for the Biba, LOMAC, MLS, and Test 2003-04-15 20:51:18 +00:00
mac_mls Enable the MAC_ALWAYS_LABEL_MBUF flag for the Biba, LOMAC, MLS, and Test 2003-04-15 20:51:18 +00:00
mac_none Trim "trustedbsd_" from the front of the policy module "short names"; 2003-03-27 19:26:39 +00:00
mac_partition Trim "trustedbsd_" from the front of the policy module "short names"; 2003-03-27 19:26:39 +00:00
mac_portacl Including <sys/stdint.h> is (almost?) universally only to be able to use 2003-03-18 08:45:25 +00:00
mac_seeotheruids Trim "trustedbsd_" from the front of the policy module "short names"; 2003-03-27 19:26:39 +00:00
mac_stub Trim "trustedbsd_" from the front of the policy module "short names"; 2003-03-27 19:26:39 +00:00
mac_test Modify mac_test policy to invoke WITNESS_WARN() when a potentially 2003-04-15 21:20:34 +00:00