blob: de14030823cdaef6c285887663bd9f8b6df68eae [file] [log] [blame]
Tetsuo Handa847b1732010-02-11 09:43:54 +09001/*
2 * security/tomoyo/gc.c
3 *
4 * Implementation of the Domain-Based Mandatory Access Control.
5 *
6 * Copyright (C) 2005-2010 NTT DATA CORPORATION
7 *
8 */
9
10#include "common.h"
11#include <linux/kthread.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090012#include <linux/slab.h>
Tetsuo Handa847b1732010-02-11 09:43:54 +090013
Tetsuo Handae2bf6902010-06-25 11:16:00 +090014struct tomoyo_gc {
Tetsuo Handa847b1732010-02-11 09:43:54 +090015 struct list_head list;
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +090016 enum tomoyo_policy_id type;
Tetsuo Handae79acf02010-06-16 16:31:50 +090017 struct list_head *element;
Tetsuo Handa847b1732010-02-11 09:43:54 +090018};
19static LIST_HEAD(tomoyo_gc_queue);
20static DEFINE_MUTEX(tomoyo_gc_mutex);
21
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +090022/**
23 * tomoyo_add_to_gc - Add an entry to to be deleted list.
24 *
25 * @type: One of values in "enum tomoyo_policy_id".
26 * @element: Pointer to "struct list_head".
27 *
28 * Returns true on success, false otherwise.
29 *
30 * Caller holds tomoyo_policy_lock mutex.
31 *
32 * Adding an entry needs kmalloc(). Thus, if we try to add thousands of
33 * entries at once, it will take too long time. Thus, do not add more than 128
34 * entries per a scan. But to be able to handle worst case where all entries
35 * are in-use, we accept one more entry per a scan.
36 *
37 * If we use singly linked list using "struct list_head"->prev (which is
38 * LIST_POISON2), we can avoid kmalloc().
39 */
Tetsuo Handae79acf02010-06-16 16:31:50 +090040static bool tomoyo_add_to_gc(const int type, struct list_head *element)
Tetsuo Handa847b1732010-02-11 09:43:54 +090041{
Tetsuo Handae2bf6902010-06-25 11:16:00 +090042 struct tomoyo_gc *entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
Tetsuo Handa847b1732010-02-11 09:43:54 +090043 if (!entry)
44 return false;
45 entry->type = type;
46 entry->element = element;
47 list_add(&entry->list, &tomoyo_gc_queue);
Tetsuo Handae79acf02010-06-16 16:31:50 +090048 list_del_rcu(element);
Tetsuo Handa847b1732010-02-11 09:43:54 +090049 return true;
50}
51
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +090052/**
53 * tomoyo_del_transition_control - Delete members in "struct tomoyo_transition_control".
54 *
55 * @element: Pointer to "struct list_head".
56 *
57 * Returns nothing.
58 */
Tetsuo Handa5448ec42010-06-21 11:14:39 +090059static void tomoyo_del_transition_control(struct list_head *element)
Tetsuo Handa847b1732010-02-11 09:43:54 +090060{
Tetsuo Handa5448ec42010-06-21 11:14:39 +090061 struct tomoyo_transition_control *ptr =
Tetsuo Handae79acf02010-06-16 16:31:50 +090062 container_of(element, typeof(*ptr), head.list);
Tetsuo Handa847b1732010-02-11 09:43:54 +090063 tomoyo_put_name(ptr->domainname);
64 tomoyo_put_name(ptr->program);
65}
66
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +090067/**
68 * tomoyo_del_aggregator - Delete members in "struct tomoyo_aggregator".
69 *
70 * @element: Pointer to "struct list_head".
71 *
72 * Returns nothing.
73 */
Tetsuo Handae79acf02010-06-16 16:31:50 +090074static void tomoyo_del_aggregator(struct list_head *element)
Tetsuo Handa10843072010-06-03 20:38:03 +090075{
Tetsuo Handae2bf6902010-06-25 11:16:00 +090076 struct tomoyo_aggregator *ptr =
Tetsuo Handae79acf02010-06-16 16:31:50 +090077 container_of(element, typeof(*ptr), head.list);
Tetsuo Handa10843072010-06-03 20:38:03 +090078 tomoyo_put_name(ptr->original_name);
79 tomoyo_put_name(ptr->aggregated_name);
80}
81
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +090082/**
83 * tomoyo_del_manager - Delete members in "struct tomoyo_manager".
84 *
85 * @element: Pointer to "struct list_head".
86 *
87 * Returns nothing.
88 */
Tetsuo Handae79acf02010-06-16 16:31:50 +090089static void tomoyo_del_manager(struct list_head *element)
Tetsuo Handa847b1732010-02-11 09:43:54 +090090{
Tetsuo Handae2bf6902010-06-25 11:16:00 +090091 struct tomoyo_manager *ptr =
Tetsuo Handae79acf02010-06-16 16:31:50 +090092 container_of(element, typeof(*ptr), head.list);
Tetsuo Handa847b1732010-02-11 09:43:54 +090093 tomoyo_put_name(ptr->manager);
94}
95
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +090096/**
97 * tomoyo_del_acl - Delete members in "struct tomoyo_acl_info".
98 *
99 * @element: Pointer to "struct list_head".
100 *
101 * Returns nothing.
102 */
Tetsuo Handae79acf02010-06-16 16:31:50 +0900103static void tomoyo_del_acl(struct list_head *element)
Tetsuo Handa847b1732010-02-11 09:43:54 +0900104{
Tetsuo Handae79acf02010-06-16 16:31:50 +0900105 struct tomoyo_acl_info *acl =
106 container_of(element, typeof(*acl), list);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900107 switch (acl->type) {
Tetsuo Handa7ef61232010-02-16 08:03:30 +0900108 case TOMOYO_TYPE_PATH_ACL:
Tetsuo Handa847b1732010-02-11 09:43:54 +0900109 {
Tetsuo Handa7ef61232010-02-16 08:03:30 +0900110 struct tomoyo_path_acl *entry
Tetsuo Handa847b1732010-02-11 09:43:54 +0900111 = container_of(acl, typeof(*entry), head);
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900112 tomoyo_put_name_union(&entry->name);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900113 }
114 break;
Tetsuo Handa7ef61232010-02-16 08:03:30 +0900115 case TOMOYO_TYPE_PATH2_ACL:
Tetsuo Handa847b1732010-02-11 09:43:54 +0900116 {
Tetsuo Handa7ef61232010-02-16 08:03:30 +0900117 struct tomoyo_path2_acl *entry
Tetsuo Handa847b1732010-02-11 09:43:54 +0900118 = container_of(acl, typeof(*entry), head);
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900119 tomoyo_put_name_union(&entry->name1);
120 tomoyo_put_name_union(&entry->name2);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900121 }
122 break;
Tetsuo Handaa1f9bb62010-05-17 10:09:15 +0900123 case TOMOYO_TYPE_PATH_NUMBER_ACL:
124 {
125 struct tomoyo_path_number_acl *entry
126 = container_of(acl, typeof(*entry), head);
127 tomoyo_put_name_union(&entry->name);
128 tomoyo_put_number_union(&entry->number);
129 }
130 break;
Tetsuo Handa75093152010-06-16 16:23:55 +0900131 case TOMOYO_TYPE_MKDEV_ACL:
Tetsuo Handaa1f9bb62010-05-17 10:09:15 +0900132 {
Tetsuo Handa75093152010-06-16 16:23:55 +0900133 struct tomoyo_mkdev_acl *entry
Tetsuo Handaa1f9bb62010-05-17 10:09:15 +0900134 = container_of(acl, typeof(*entry), head);
135 tomoyo_put_name_union(&entry->name);
136 tomoyo_put_number_union(&entry->mode);
137 tomoyo_put_number_union(&entry->major);
138 tomoyo_put_number_union(&entry->minor);
139 }
140 break;
Tetsuo Handa2106ccd2010-05-17 10:10:31 +0900141 case TOMOYO_TYPE_MOUNT_ACL:
142 {
143 struct tomoyo_mount_acl *entry
144 = container_of(acl, typeof(*entry), head);
145 tomoyo_put_name_union(&entry->dev_name);
146 tomoyo_put_name_union(&entry->dir_name);
147 tomoyo_put_name_union(&entry->fs_type);
148 tomoyo_put_number_union(&entry->flags);
149 }
150 break;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900151 }
152}
153
Tetsuo Handae79acf02010-06-16 16:31:50 +0900154static bool tomoyo_del_domain(struct list_head *element)
Tetsuo Handa847b1732010-02-11 09:43:54 +0900155{
Tetsuo Handae79acf02010-06-16 16:31:50 +0900156 struct tomoyo_domain_info *domain =
157 container_of(element, typeof(*domain), list);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900158 struct tomoyo_acl_info *acl;
159 struct tomoyo_acl_info *tmp;
160 /*
161 * Since we don't protect whole execve() operation using SRCU,
162 * we need to recheck domain->users at this point.
163 *
164 * (1) Reader starts SRCU section upon execve().
165 * (2) Reader traverses tomoyo_domain_list and finds this domain.
166 * (3) Writer marks this domain as deleted.
167 * (4) Garbage collector removes this domain from tomoyo_domain_list
168 * because this domain is marked as deleted and used by nobody.
169 * (5) Reader saves reference to this domain into
170 * "struct linux_binprm"->cred->security .
171 * (6) Reader finishes SRCU section, although execve() operation has
172 * not finished yet.
173 * (7) Garbage collector waits for SRCU synchronization.
174 * (8) Garbage collector kfree() this domain because this domain is
175 * used by nobody.
176 * (9) Reader finishes execve() operation and restores this domain from
177 * "struct linux_binprm"->cred->security.
178 *
179 * By updating domain->users at (5), we can solve this race problem
180 * by rechecking domain->users at (8).
181 */
182 if (atomic_read(&domain->users))
183 return false;
184 list_for_each_entry_safe(acl, tmp, &domain->acl_info_list, list) {
Tetsuo Handae79acf02010-06-16 16:31:50 +0900185 tomoyo_del_acl(&acl->list);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900186 tomoyo_memory_free(acl);
187 }
188 tomoyo_put_name(domain->domainname);
189 return true;
190}
191
192
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900193/**
194 * tomoyo_del_name - Delete members in "struct tomoyo_name".
195 *
196 * @element: Pointer to "struct list_head".
197 *
198 * Returns nothing.
199 */
Tetsuo Handae79acf02010-06-16 16:31:50 +0900200static void tomoyo_del_name(struct list_head *element)
Tetsuo Handa847b1732010-02-11 09:43:54 +0900201{
Tetsuo Handae2bf6902010-06-25 11:16:00 +0900202 const struct tomoyo_name *ptr =
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900203 container_of(element, typeof(*ptr), head.list);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900204}
205
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900206/**
207 * tomoyo_del_path_group - Delete members in "struct tomoyo_path_group".
208 *
209 * @element: Pointer to "struct list_head".
210 *
211 * Returns nothing.
212 */
Tetsuo Handaa98aa4d2010-06-17 16:52:29 +0900213static void tomoyo_del_path_group(struct list_head *element)
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900214{
Tetsuo Handaa98aa4d2010-06-17 16:52:29 +0900215 struct tomoyo_path_group *member =
Tetsuo Handae79acf02010-06-16 16:31:50 +0900216 container_of(element, typeof(*member), head.list);
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900217 tomoyo_put_name(member->member_name);
218}
219
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900220/**
221 * tomoyo_del_group - Delete "struct tomoyo_group".
222 *
223 * @element: Pointer to "struct list_head".
224 *
225 * Returns nothing.
226 */
Tetsuo Handaa98aa4d2010-06-17 16:52:29 +0900227static void tomoyo_del_group(struct list_head *element)
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900228{
Tetsuo Handaa98aa4d2010-06-17 16:52:29 +0900229 struct tomoyo_group *group =
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900230 container_of(element, typeof(*group), head.list);
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900231 tomoyo_put_name(group->group_name);
232}
233
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900234/**
235 * tomoyo_del_number_group - Delete members in "struct tomoyo_number_group".
236 *
237 * @element: Pointer to "struct list_head".
238 *
239 * Returns nothing.
240 */
Tetsuo Handae79acf02010-06-16 16:31:50 +0900241static void tomoyo_del_number_group(struct list_head *element)
Tetsuo Handa4c3e9e22010-05-17 10:06:58 +0900242{
Tetsuo Handaa98aa4d2010-06-17 16:52:29 +0900243 struct tomoyo_number_group *member =
244 container_of(element, typeof(*member), head.list);
Tetsuo Handa4c3e9e22010-05-17 10:06:58 +0900245}
246
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900247/**
248 * tomoyo_collect_member - Delete elements with "struct tomoyo_acl_head".
249 *
250 * @id: One of values in "enum tomoyo_policy_id".
251 * @member_list: Pointer to "struct list_head".
252 *
253 * Returns true if some elements are deleted, false otherwise.
254 */
255static bool tomoyo_collect_member(const enum tomoyo_policy_id id,
256 struct list_head *member_list)
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900257{
258 struct tomoyo_acl_head *member;
259 list_for_each_entry(member, member_list, list) {
260 if (!member->is_deleted)
261 continue;
262 if (!tomoyo_add_to_gc(id, &member->list))
263 return false;
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900264 }
265 return true;
266}
267
268static bool tomoyo_collect_acl(struct tomoyo_domain_info *domain)
269{
270 struct tomoyo_acl_info *acl;
271 list_for_each_entry(acl, &domain->acl_info_list, list) {
272 if (!acl->is_deleted)
273 continue;
274 if (!tomoyo_add_to_gc(TOMOYO_ID_ACL, &acl->list))
275 return false;
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900276 }
277 return true;
278}
279
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900280/**
281 * tomoyo_collect_entry - Scan lists for deleted elements.
282 *
283 * Returns nothing.
284 */
Tetsuo Handa847b1732010-02-11 09:43:54 +0900285static void tomoyo_collect_entry(void)
286{
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900287 int i;
Tetsuo Handa29282382010-05-06 00:18:15 +0900288 if (mutex_lock_interruptible(&tomoyo_policy_lock))
289 return;
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900290 for (i = 0; i < TOMOYO_MAX_POLICY; i++) {
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900291 if (!tomoyo_collect_member(i, &tomoyo_policy_list[i]))
Tetsuo Handaa230f9e2010-06-17 16:53:24 +0900292 goto unlock;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900293 }
294 {
295 struct tomoyo_domain_info *domain;
296 list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) {
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900297 if (!tomoyo_collect_acl(domain))
298 goto unlock;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900299 if (!domain->is_deleted || atomic_read(&domain->users))
300 continue;
301 /*
302 * Nobody is referring this domain. But somebody may
303 * refer this domain after successful execve().
304 * We recheck domain->users after SRCU synchronization.
305 */
Tetsuo Handae79acf02010-06-16 16:31:50 +0900306 if (!tomoyo_add_to_gc(TOMOYO_ID_DOMAIN, &domain->list))
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900307 goto unlock;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900308 }
309 }
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900310 for (i = 0; i < TOMOYO_MAX_HASH; i++) {
Tetsuo Handae2bf6902010-06-25 11:16:00 +0900311 struct tomoyo_name *ptr;
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900312 list_for_each_entry_rcu(ptr, &tomoyo_name_list[i], head.list) {
313 if (atomic_read(&ptr->head.users))
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900314 continue;
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900315 if (!tomoyo_add_to_gc(TOMOYO_ID_NAME, &ptr->head.list))
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900316 goto unlock;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900317 }
318 }
Tetsuo Handa7c2ea222010-06-17 16:55:58 +0900319 for (i = 0; i < TOMOYO_MAX_GROUP; i++) {
320 struct list_head *list = &tomoyo_group_list[i];
321 int id;
Tetsuo Handaa98aa4d2010-06-17 16:52:29 +0900322 struct tomoyo_group *group;
Tetsuo Handa7c2ea222010-06-17 16:55:58 +0900323 switch (i) {
324 case 0:
325 id = TOMOYO_ID_PATH_GROUP;
326 break;
327 default:
328 id = TOMOYO_ID_NUMBER_GROUP;
329 break;
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900330 }
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900331 list_for_each_entry(group, list, head.list) {
332 if (!tomoyo_collect_member(id, &group->member_list))
Tetsuo Handa7c2ea222010-06-17 16:55:58 +0900333 goto unlock;
Tetsuo Handa4c3e9e22010-05-17 10:06:58 +0900334 if (!list_empty(&group->member_list) ||
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900335 atomic_read(&group->head.users))
Tetsuo Handa4c3e9e22010-05-17 10:06:58 +0900336 continue;
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900337 if (!tomoyo_add_to_gc(TOMOYO_ID_GROUP,
338 &group->head.list))
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900339 goto unlock;
Tetsuo Handa4c3e9e22010-05-17 10:06:58 +0900340 }
341 }
Tetsuo Handad2f8b232010-06-15 10:10:37 +0900342 unlock:
Tetsuo Handa29282382010-05-06 00:18:15 +0900343 mutex_unlock(&tomoyo_policy_lock);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900344}
345
346static void tomoyo_kfree_entry(void)
347{
Tetsuo Handae2bf6902010-06-25 11:16:00 +0900348 struct tomoyo_gc *p;
349 struct tomoyo_gc *tmp;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900350
351 list_for_each_entry_safe(p, tmp, &tomoyo_gc_queue, list) {
Tetsuo Handae79acf02010-06-16 16:31:50 +0900352 struct list_head *element = p->element;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900353 switch (p->type) {
Tetsuo Handa5448ec42010-06-21 11:14:39 +0900354 case TOMOYO_ID_TRANSITION_CONTROL:
355 tomoyo_del_transition_control(element);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900356 break;
Tetsuo Handa10843072010-06-03 20:38:03 +0900357 case TOMOYO_ID_AGGREGATOR:
Tetsuo Handae79acf02010-06-16 16:31:50 +0900358 tomoyo_del_aggregator(element);
Tetsuo Handa10843072010-06-03 20:38:03 +0900359 break;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900360 case TOMOYO_ID_MANAGER:
Tetsuo Handae79acf02010-06-16 16:31:50 +0900361 tomoyo_del_manager(element);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900362 break;
363 case TOMOYO_ID_NAME:
Tetsuo Handae79acf02010-06-16 16:31:50 +0900364 tomoyo_del_name(element);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900365 break;
366 case TOMOYO_ID_ACL:
Tetsuo Handae79acf02010-06-16 16:31:50 +0900367 tomoyo_del_acl(element);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900368 break;
369 case TOMOYO_ID_DOMAIN:
Tetsuo Handae79acf02010-06-16 16:31:50 +0900370 if (!tomoyo_del_domain(element))
Tetsuo Handa847b1732010-02-11 09:43:54 +0900371 continue;
372 break;
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900373 case TOMOYO_ID_PATH_GROUP:
Tetsuo Handae79acf02010-06-16 16:31:50 +0900374 tomoyo_del_path_group(element);
Tetsuo Handa7762fbf2010-05-10 17:30:26 +0900375 break;
Tetsuo Handaa98aa4d2010-06-17 16:52:29 +0900376 case TOMOYO_ID_GROUP:
377 tomoyo_del_group(element);
Tetsuo Handa4c3e9e22010-05-17 10:06:58 +0900378 break;
379 case TOMOYO_ID_NUMBER_GROUP:
Tetsuo Handae79acf02010-06-16 16:31:50 +0900380 tomoyo_del_number_group(element);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900381 break;
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900382 case TOMOYO_MAX_POLICY:
383 break;
Tetsuo Handa847b1732010-02-11 09:43:54 +0900384 }
Tetsuo Handae79acf02010-06-16 16:31:50 +0900385 tomoyo_memory_free(element);
Tetsuo Handa847b1732010-02-11 09:43:54 +0900386 list_del(&p->list);
387 kfree(p);
388 }
389}
390
Tetsuo Handa0df7e8b2011-06-26 23:16:36 +0900391/**
392 * tomoyo_gc_thread - Garbage collector thread function.
393 *
394 * @unused: Unused.
395 *
396 * In case OOM-killer choose this thread for termination, we create this thread
397 * as a short live thread whenever /sys/kernel/security/tomoyo/ interface was
398 * close()d.
399 *
400 * Returns 0.
401 */
Tetsuo Handa847b1732010-02-11 09:43:54 +0900402static int tomoyo_gc_thread(void *unused)
403{
404 daemonize("GC for TOMOYO");
405 if (mutex_trylock(&tomoyo_gc_mutex)) {
406 int i;
407 for (i = 0; i < 10; i++) {
408 tomoyo_collect_entry();
409 if (list_empty(&tomoyo_gc_queue))
410 break;
411 synchronize_srcu(&tomoyo_ss);
412 tomoyo_kfree_entry();
413 }
414 mutex_unlock(&tomoyo_gc_mutex);
415 }
416 do_exit(0);
417}
418
419void tomoyo_run_gc(void)
420{
421 struct task_struct *task = kthread_create(tomoyo_gc_thread, NULL,
422 "GC for TOMOYO");
423 if (!IS_ERR(task))
424 wake_up_process(task);
425}