aboutsummaryrefslogtreecommitdiffstats
path: root/security/tomoyo/memory.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2011-06-26 10:19:52 -0400
committerJames Morris <jmorris@namei.org>2011-06-28 19:31:21 -0400
commitbd03a3e4c9a9df0c6b007045fa7fc8889111a478 (patch)
tree9d78290c878e6466fe3e0bda7ee5989c0dc39e40 /security/tomoyo/memory.c
parent32997144fd9925fc4d506a16990a0c405f766526 (diff)
TOMOYO: Add policy namespace support.
Mauras Olivier reported that it is difficult to use TOMOYO in LXC environments, for TOMOYO cannot distinguish between environments outside the container and environments inside the container since LXC environments are created using pivot_root(). To address this problem, this patch introduces policy namespace. Each policy namespace has its own set of domain policy, exception policy and profiles, which are all independent of other namespaces. This independency allows users to develop policy without worrying interference among namespaces. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
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