#include <rsbac/types.h>
#include <rsbac/rkmem.h>
#include <rsbac/debug.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/timer.h>
Go to the source code of this file.
Data Structures | |
struct | rsbac_cache_sizes |
Typedefs | |
typedef rsbac_cache_sizes | rsbac_cache_sizes_t |
Functions | |
void __init | rsbac_kmem_cache_sizes_init (void) |
void * | rsbac_kmalloc (size_t size) |
void * | rsbac_vkmalloc (size_t size, rsbac_boolean_t *vmalloc_used_p) |
static void | wakeup_kfree (u_long dk_dummy) |
Variables | |
static rsbac_cache_sizes_t | rsbac_cache_sizes [] |
typedef struct rsbac_cache_sizes rsbac_cache_sizes_t |
void* rsbac_kmalloc | ( | size_t | size | ) |
rsbac_kmalloc - allocate memory : how many bytes of memory are required.
rsbac_kmalloc is the normal method of allocating memory for RSBAC in the kernel. It will always be of type GFP_KERNEL in 2.4 and GFP_ATOMIC in 2.6.
rsbac_kmalloc'd memory is freed by rsbac_kfree
Definition at line 97 of file rkmem.c.
References rsbac_cache_sizes::cs_cachep, rsbac_cache_sizes::cs_size, KERNEL_VERSION, NULL, rsbac_cache_sizes, RSBAC_MAX_KMALLOC, and rsbac_printk().
Referenced by aci_detach_fd_lists(), acl_detach_fd_lists(), acl_register_fd_lists(), add_device_item(), add_item(), add_lol_item(), add_lol_subitem(), add_sc_item(), auth_detach_fd_lists(), auth_register_fd_lists(), auto_read_attr(), auto_read_write_attr(), auto_write_attr(), check_buffer(), check_comp_rc(), create_device_item(), create_lol_reg(), create_reg(), do_lol_rehash(), do_read_list(), do_read_lol_list(), do_rehash(), fill_buffer(), fill_lol_buffer(), get_attribute_value_name(), get_target_name(), mac_detach_fd_lists(), mac_register_fd_lists(), register_fd_lists(), registration_error(), remove_device_item(), rsbac_acl_check_forward(), rsbac_acl_check_right(), rsbac_acl_check_super(), rsbac_acl_sys_add_to_acl_entry(), rsbac_acl_sys_get_mask(), rsbac_acl_sys_get_rights(), rsbac_acl_sys_get_tlist(), rsbac_acl_sys_group(), rsbac_acl_sys_remove_acl(), rsbac_acl_sys_remove_acl_entry(), rsbac_acl_sys_remove_from_acl_entry(), rsbac_acl_sys_remove_user(), rsbac_acl_sys_set_acl_entry(), rsbac_acl_sys_set_mask(), rsbac_adf_request_int(), rsbac_adf_set_attr(), rsbac_do_init(), rsbac_get_full_path(), rsbac_init(), rsbac_init_auth(), rsbac_init_debug(), rsbac_init_mac(), rsbac_init_um(), rsbac_jail_sys_jail(), rsbac_list_write_buffers(), rsbac_list_write_lol_buffers(), rsbac_mac_set_curr_level(), rsbac_mount(), rsbac_mount_acl(), rsbac_printk(), rsbac_rc_get_item(), rsbac_rc_sys_change_role(), rsbac_rc_sys_copy_type(), rsbac_read_open(), rsbac_um_check_account(), rsbac_um_check_pass(), rsbac_um_get_group_item(), rsbac_um_get_user_item(), rsbac_um_good_pass(), rsbac_um_hash(), rsbac_um_mod_group(), rsbac_um_mod_user(), rsbac_um_set_group_pass(), rsbac_um_set_pass(), rsbac_write_open(), sys_rsbac_adf_log_switch(), sys_rsbac_get_adf_log(), sys_rsbac_switch(), sys_rsbac_um_add_group(), sys_rsbac_um_add_user(), sys_rsbac_um_auth_name(), sys_rsbac_um_auth_uid(), sys_rsbac_um_get_group_item(), sys_rsbac_um_get_user_item(), sys_rsbac_um_mod_group(), sys_rsbac_um_mod_user(), sys_rsbac_um_set_group_pass(), sys_rsbac_um_set_pass(), sys_rsbac_um_set_pass_name(), and xp_malloc().
00098 { 00099 rsbac_cache_sizes_t *csizep = rsbac_cache_sizes; 00100 00101 if(!size) 00102 return NULL; 00103 for (; csizep->cs_size; csizep++) { 00104 if (size > csizep->cs_size) 00105 continue; 00106 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 00107 return kmem_cache_alloc(csizep->cs_cachep, GFP_ATOMIC); 00108 #else 00109 return kmem_cache_alloc(csizep->cs_cachep, GFP_KERNEL); 00110 #endif 00111 } 00112 rsbac_printk(KERN_WARNING 00113 "rsbac_kmalloc: size %u requested, max size is %u!\n", 00114 size, RSBAC_MAX_KMALLOC); 00115 BUG(); 00116 return NULL; 00117 }
void __init rsbac_kmem_cache_sizes_init | ( | void | ) |
Definition at line 67 of file rkmem.c.
References rsbac_cache_sizes::cs_cachep, rsbac_cache_sizes::cs_size, rsbac_cache_sizes::name, NULL, and rsbac_cache_sizes.
Referenced by rsbac_do_init().
00069 { 00070 rsbac_cache_sizes_t *sizes = rsbac_cache_sizes; 00071 00072 while (sizes->cs_size) { 00073 sizes->cs_cachep = kmem_cache_create( 00074 sizes->name, sizes->cs_size, 00075 0, SLAB_HWCACHE_ALIGN, NULL, NULL); 00076 if (!sizes->cs_cachep) 00077 BUG(); 00078 00079 sizes++; 00080 } 00081 }
void* rsbac_vkmalloc | ( | size_t | size, | |
rsbac_boolean_t * | vmalloc_used_p | |||
) |
Definition at line 122 of file rkmem.c.
References rsbac_cache_sizes::cs_cachep, rsbac_cache_sizes::cs_size, FALSE, KERNEL_VERSION, NULL, and rsbac_cache_sizes.
00123 { 00124 rsbac_cache_sizes_t *csizep = rsbac_cache_sizes; 00125 void * result; 00126 00127 if(!size) 00128 return NULL; 00129 for (; csizep->cs_size; csizep++) { 00130 if (size > csizep->cs_size) 00131 continue; 00132 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 00133 result = kmem_cache_alloc(csizep->cs_cachep, GFP_ATOMIC); 00134 #else 00135 result = kmem_cache_alloc(csizep->cs_cachep, GFP_KERNEL); 00136 #endif 00137 if(result) 00138 { 00139 if(vmalloc_used_p) 00140 *vmalloc_used_p = FALSE; 00141 return result; 00142 } 00143 } 00144 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) 00145 return NULL; 00146 #else 00147 if(vmalloc_used_p) 00148 *vmalloc_used_p = TRUE; 00149 return vmalloc(size); 00150 #endif 00151 }
static void wakeup_kfree | ( | u_long | dk_dummy | ) | [static] |
Definition at line 153 of file rkmem.c.
References rsbac_delayed_kfree_t::objp.
00154 { 00155 struct rsbac_delayed_kfree_t * dk_p = (struct rsbac_delayed_kfree_t *) dk_dummy; 00156 00157 kfree(dk_p->objp); 00158 kfree(dk_p); 00159 }
rsbac_cache_sizes_t rsbac_cache_sizes[] [static] |
Definition at line 27 of file rkmem.c.
Referenced by rsbac_kmalloc(), rsbac_kmem_cache_sizes_init(), and rsbac_vkmalloc().