aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/tomoyo/memory.c')
-rw-r--r--security/tomoyo/memory.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/security/tomoyo/memory.c b/security/tomoyo/memory.c
index 7a0493943d6d..39d012823f84 100644
--- a/security/tomoyo/memory.c
+++ b/security/tomoyo/memory.c
@@ -118,7 +118,7 @@ struct tomoyo_group *tomoyo_get_group(struct tomoyo_acl_param *param,
118 return NULL; 118 return NULL;
119 if (mutex_lock_interruptible(&tomoyo_policy_lock)) 119 if (mutex_lock_interruptible(&tomoyo_policy_lock))
120 goto out; 120 goto out;
121 list = &tomoyo_group_list[idx]; 121 list = &param->ns->group_list[idx];
122 list_for_each_entry(group, list, head.list) { 122 list_for_each_entry(group, list, head.list) {
123 if (e.group_name != group->group_name) 123 if (e.group_name != group->group_name)
124 continue; 124 continue;
@@ -199,27 +199,23 @@ const struct tomoyo_path_info *tomoyo_get_name(const char *name)
199 return ptr ? &ptr->entry : NULL; 199 return ptr ? &ptr->entry : NULL;
200} 200}
201 201
202/* Initial namespace.*/
203struct tomoyo_policy_namespace tomoyo_kernel_namespace;
204
202/** 205/**
203 * tomoyo_mm_init - Initialize mm related code. 206 * tomoyo_mm_init - Initialize mm related code.
204 */ 207 */
205void __init tomoyo_mm_init(void) 208void __init tomoyo_mm_init(void)
206{ 209{
207 int idx; 210 int idx;
208
209 for (idx = 0; idx < TOMOYO_MAX_POLICY; idx++)
210 INIT_LIST_HEAD(&tomoyo_policy_list[idx]);
211 for (idx = 0; idx < TOMOYO_MAX_GROUP; idx++)
212 INIT_LIST_HEAD(&tomoyo_group_list[idx]);
213 for (idx = 0; idx < TOMOYO_MAX_HASH; idx++) 211 for (idx = 0; idx < TOMOYO_MAX_HASH; idx++)
214 INIT_LIST_HEAD(&tomoyo_name_list[idx]); 212 INIT_LIST_HEAD(&tomoyo_name_list[idx]);
213 tomoyo_kernel_namespace.name = "<kernel>";
214 tomoyo_init_policy_namespace(&tomoyo_kernel_namespace);
215 tomoyo_kernel_domain.ns = &tomoyo_kernel_namespace;
215 INIT_LIST_HEAD(&tomoyo_kernel_domain.acl_info_list); 216 INIT_LIST_HEAD(&tomoyo_kernel_domain.acl_info_list);
216 for (idx = 0; idx < TOMOYO_MAX_ACL_GROUPS; idx++) 217 tomoyo_kernel_domain.domainname = tomoyo_get_name("<kernel>");
217 INIT_LIST_HEAD(&tomoyo_acl_group[idx]);
218 tomoyo_kernel_domain.domainname = tomoyo_get_name(TOMOYO_ROOT_NAME);
219 list_add_tail_rcu(&tomoyo_kernel_domain.list, &tomoyo_domain_list); 218 list_add_tail_rcu(&tomoyo_kernel_domain.list, &tomoyo_domain_list);
220 idx = tomoyo_read_lock();
221 if (tomoyo_find_domain(TOMOYO_ROOT_NAME) != &tomoyo_kernel_domain)
222 panic("Can't register tomoyo_kernel_domain");
223#if 0 219#if 0
224 /* Will be replaced with tomoyo_load_builtin_policy(). */ 220 /* Will be replaced with tomoyo_load_builtin_policy(). */
225 { 221 {
@@ -230,7 +226,6 @@ void __init tomoyo_mm_init(void)
230 TOMOYO_TRANSITION_CONTROL_INITIALIZE); 226 TOMOYO_TRANSITION_CONTROL_INITIALIZE);
231 } 227 }
232#endif 228#endif
233 tomoyo_read_unlock(idx);
234} 229}
235 230
236 231