[Devel] [PATCH 1/1] cr: child user namespace must grab ref to creator
Serge E. Hallyn
serue at us.ibm.com
Tue May 12 05:34:16 PDT 2009
This applies on top of yesterday's patchset.
thanks,
-serge
>From f70a08dc6abdba372e1b3e1f25aadb919d07b171 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue at us.ibm.com>
Date: Tue, 12 May 2009 08:17:34 -0400
Subject: [PATCH 1/1] cr: child user namespace must grab ref to creator
With this change plus Oren's proposed fix to obj_put() after
obj_new() during restore_obj(), refcounting on user_ns and
user_struct should be completely correct.
Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
---
checkpoint/process.c | 24 +++---------------------
1 files changed, 3 insertions(+), 21 deletions(-)
diff --git a/checkpoint/process.c b/checkpoint/process.c
index a469f46..a8cd674 100644
--- a/checkpoint/process.c
+++ b/checkpoint/process.c
@@ -569,27 +569,9 @@ static struct user_namespace *restore_read_userns(struct ckpt_ctx *ctx)
if (IS_ERR(ns))
return ns;
- /* we need a way to keep track of the new_root just
- * until we alloc the uid inthe userns which we
- * actually want. Then we can do:
- * if (uid == 0)
- * new_user = new_root;
- * else
- * new_user = alloc_uid(ns, uid);
- * free_uid(new_root);
- * cred->user = new_user;
- * This is because new_root is right now the only
- * thing pinning the user_ns.
- * BUT I don't think I can just add it to the
- * objhash, bc then we use up an objref which we'll
- * need for the next real objhash object, right?
- * I suppose I could just add them to the top of
- * the objref space :) (MAX_INT-1)
- *
- * For now, this code is just plain wrong bc it will
- * leak the user_ns and its root_user when the task
- * exits. But, a leak is better than an OOPS...
- */
+ /* new_user_ns() doesn't bump creator's refcount */
+ get_uid(creator);
+
return ns;
}
--
1.6.1
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list