diff options
author | rwatson <rwatson@FreeBSD.org> | 2003-11-18 04:11:52 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2003-11-18 04:11:52 +0000 |
commit | ebb0b7ecdadb197ee4a399944a1ea7862a288b70 (patch) | |
tree | 8690354a57751c55100a205c601277816298a98b /sys/security | |
parent | 156325cd78d3fac3eb44da5a9a336ff959f9cd38 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/security/mac_biba/mac_biba.c | 12 | ||||
-rw-r--r-- | sys/security/mac_mls/mac_mls.c | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c index 365c397..9c9192f 100644 --- a/sys/security/mac_biba/mac_biba.c +++ b/sys/security/mac_biba/mac_biba.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> @@ -124,7 +125,7 @@ TUNABLE_INT("security.mac.biba.revocation_enabled", &revocation_enabled); static int mac_biba_slot; #define SLOT(l) ((struct mac_biba *)LABEL_TO_SLOT((l), mac_biba_slot).l_ptr) -MALLOC_DEFINE(M_MACBIBA, "biba label", "MAC/Biba labels"); +static uma_zone_t zone_biba; static __inline int biba_bit_set_empty(u_char *set) { @@ -139,11 +140,8 @@ biba_bit_set_empty(u_char *set) { static struct mac_biba * biba_alloc(int flag) { - struct mac_biba *mac_biba; - - mac_biba = malloc(sizeof(struct mac_biba), M_MACBIBA, M_ZERO | flag); - return (mac_biba); + return (uma_zalloc(zone_biba, flag | M_ZERO)); } static void @@ -151,7 +149,7 @@ biba_free(struct mac_biba *mac_biba) { if (mac_biba != NULL) - free(mac_biba, M_MACBIBA); + uma_zfree(zone_biba, mac_biba); else atomic_add_int(&destroyed_not_inited, 1); } @@ -492,6 +490,8 @@ static void mac_biba_init(struct mac_policy_conf *conf) { + zone_biba = uma_zcreate("mac_biba", sizeof(struct mac_biba), NULL, + NULL, NULL, NULL, UMA_ALIGN_PTR, 0); } /* 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); } /* |