summaryrefslogtreecommitdiffstats
path: root/sys/security/mac_mls
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2003-11-18 04:11:52 +0000
committerrwatson <rwatson@FreeBSD.org>2003-11-18 04:11:52 +0000
commitebb0b7ecdadb197ee4a399944a1ea7862a288b70 (patch)
tree8690354a57751c55100a205c601277816298a98b /sys/security/mac_mls
parent156325cd78d3fac3eb44da5a9a336ff959f9cd38 (diff)
downloadFreeBSD-src-ebb0b7ecdadb197ee4a399944a1ea7862a288b70.zip
FreeBSD-src-ebb0b7ecdadb197ee4a399944a1ea7862a288b70.tar.gz
Use UMA zone allocator for Biba and MLS labels rather than MALLOC(9).
Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
Diffstat (limited to 'sys/security/mac_mls')
-rw-r--r--sys/security/mac_mls/mac_mls.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c
index d4e7634..e3c2ef4 100644
--- a/sys/security/mac_mls/mac_mls.c
+++ b/sys/security/mac_mls/mac_mls.c
@@ -72,6 +72,7 @@
#include <netinet/in_pcb.h>
#include <netinet/ip_var.h>
+#include <vm/uma.h>
#include <vm/vm.h>
#include <sys/mac_policy.h>
@@ -113,7 +114,7 @@ SYSCTL_INT(_security_mac_mls, OID_AUTO, max_compartments, CTLFLAG_RD,
static int mac_mls_slot;
#define SLOT(l) ((struct mac_mls *)LABEL_TO_SLOT((l), mac_mls_slot).l_ptr)
-MALLOC_DEFINE(M_MACMLS, "mls label", "MAC/MLS labels");
+static uma_zone_t zone_mls;
static __inline int
mls_bit_set_empty(u_char *set) {
@@ -128,11 +129,8 @@ mls_bit_set_empty(u_char *set) {
static struct mac_mls *
mls_alloc(int flag)
{
- struct mac_mls *mac_mls;
-
- mac_mls = malloc(sizeof(struct mac_mls), M_MACMLS, M_ZERO | flag);
- return (mac_mls);
+ return (uma_zalloc(zone_mls, flag | M_ZERO));
}
static void
@@ -140,7 +138,7 @@ mls_free(struct mac_mls *mac_mls)
{
if (mac_mls != NULL)
- free(mac_mls, M_MACMLS);
+ uma_zfree(zone_mls, mac_mls);
else
atomic_add_int(&destroyed_not_inited, 1);
}
@@ -458,6 +456,8 @@ static void
mac_mls_init(struct mac_policy_conf *conf)
{
+ zone_mls = uma_zcreate("mac_mls", sizeof(struct mac_mls), NULL,
+ NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
}
/*
OpenPOWER on IntegriCloud