9 #include <linux/slab.h>
20 static inline void tomoyo_memory_free(
void *
ptr)
44 spin_lock(&tomoyo_io_buffer_list_lock);
47 spin_unlock(&tomoyo_io_buffer_list_lock);
49 if (head->
r.domain == element || head->
r.group == element ||
50 head->
r.acl == element || &head->
w.domain->list == element)
53 spin_lock(&tomoyo_io_buffer_list_lock);
58 spin_unlock(&tomoyo_io_buffer_list_lock);
70 static bool tomoyo_name_used_by_io_buffer(
const char *
string)
76 spin_lock(&tomoyo_io_buffer_list_lock);
80 spin_unlock(&tomoyo_io_buffer_list_lock);
83 const char *
w = head->
r.w[
i];
84 if (w < string || w >
string + size)
90 spin_lock(&tomoyo_io_buffer_list_lock);
95 spin_unlock(&tomoyo_io_buffer_list_lock);
106 static inline void tomoyo_del_transition_control(
struct list_head *element)
121 static inline void tomoyo_del_aggregator(
struct list_head *element)
136 static inline void tomoyo_del_manager(
struct list_head *element)
150 static void tomoyo_del_acl(
struct list_head *element)
154 tomoyo_put_condition(acl->
cond);
204 tomoyo_put_name(entry->
env);
212 tomoyo_put_group(entry->
address.group);
243 static inline void tomoyo_del_domain(
struct list_head *element)
255 tomoyo_del_acl(&acl->
list);
256 tomoyo_memory_free(acl);
285 = (
const struct tomoyo_argv *) (names_p + names_count);
288 for (i = 0; i < numbers_count; i++)
290 for (i = 0; i < names_count; i++)
292 for (i = 0; i <
argc; argv++, i++)
293 tomoyo_put_name(argv->
value);
294 for (i = 0; i < envc; envp++, i++) {
295 tomoyo_put_name(envp->
name);
296 tomoyo_put_name(envp->
value);
307 static inline void tomoyo_del_name(
struct list_head *element)
319 static inline void tomoyo_del_path_group(
struct list_head *element)
333 static inline void tomoyo_del_group(
struct list_head *element)
347 static inline void tomoyo_del_address_group(
struct list_head *element)
359 static inline void tomoyo_del_number_group(
struct list_head *element)
393 if (tomoyo_struct_used_by_io_buffer(element))
397 tomoyo_del_transition_control(element);
400 tomoyo_del_manager(element);
403 tomoyo_del_aggregator(element);
406 tomoyo_del_group(element);
409 tomoyo_del_path_group(element);
412 tomoyo_del_address_group(element);
415 tomoyo_del_number_group(element);
425 if (tomoyo_name_used_by_io_buffer
427 head.
list)->entry.name))
429 tomoyo_del_name(element);
432 tomoyo_del_acl(element);
449 tomoyo_del_domain(element);
450 tomoyo_memory_free(element);
462 list_add_rcu(element, element->
prev);
482 tomoyo_try_to_gc(
id, &member->
list);
510 static void tomoyo_collect_entry(
void)
593 static int tomoyo_gc_thread(
void *
unused)
599 tomoyo_collect_entry();
604 spin_lock(&tomoyo_io_buffer_list_lock);
614 spin_unlock(&tomoyo_io_buffer_list_lock);
632 bool is_write =
false;
634 spin_lock(&tomoyo_io_buffer_list_lock);
637 list_add(&head->
list, &tomoyo_io_buffer_list);
640 if (!--head->
users) {
647 spin_unlock(&tomoyo_io_buffer_list_lock);