aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/user.c
diff options
context:
space:
mode:
authorSerge E. Hallyn <serue@us.ibm.com>2008-12-03 14:17:06 -0500
committerJames Morris <jmorris@namei.org>2008-12-07 17:16:22 -0500
commitc37bbb0fdcc01610fd55604eb6927210a1d20044 (patch)
tree41b53e385d947c568b237f5eb3690098d2efd8f6 /kernel/user.c
parentec98ce480ada787f2cfbd696980ff3564415505b (diff)
user namespaces: let user_ns be cloned with fairsched
(These two patches are in the next-unacked branch of git://git.kernel.org/pub/scm/linux/kernel/git/sergeh/userns-2.6. If they get some ACKs, then I hope to feed this into security-next. After these two, I think we're ready to tackle userns+capabilities) Fairsched creates a per-uid directory under /sys/kernel/uids/. So when you clone(CLONE_NEWUSER), it tries to create /sys/kernel/uids/0, which already exists, and you get back -ENOMEM. This was supposed to be fixed by sysfs tagging, but that was postponed (ok, rejected until sysfs locking is fixed). So, just as with network namespaces, we just don't create those directories for user namespaces other than the init. Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'kernel/user.c')
-rw-r--r--kernel/user.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/user.c b/kernel/user.c
index 97202cb29adc..6c924bc48c08 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -246,6 +246,8 @@ static int uids_user_create(struct user_struct *up)
246 int error; 246 int error;
247 247
248 memset(kobj, 0, sizeof(struct kobject)); 248 memset(kobj, 0, sizeof(struct kobject));
249 if (up->user_ns != &init_user_ns)
250 return 0;
249 kobj->kset = uids_kset; 251 kobj->kset = uids_kset;
250 error = kobject_init_and_add(kobj, &uids_ktype, NULL, "%d", up->uid); 252 error = kobject_init_and_add(kobj, &uids_ktype, NULL, "%d", up->uid);
251 if (error) { 253 if (error) {
@@ -281,6 +283,8 @@ static void remove_user_sysfs_dir(struct work_struct *w)
281 unsigned long flags; 283 unsigned long flags;
282 int remove_user = 0; 284 int remove_user = 0;
283 285
286 if (up->user_ns != &init_user_ns)
287 return;
284 /* Make uid_hash_remove() + sysfs_remove_file() + kobject_del() 288 /* Make uid_hash_remove() + sysfs_remove_file() + kobject_del()
285 * atomic. 289 * atomic.
286 */ 290 */