All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>,
	Linux Containers
	<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Alexey Dobriyan
	<adobriyan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 1/1] cr: child user namespace must grab ref to creator
Date: Tue, 12 May 2009 07:34:16 -0500	[thread overview]
Message-ID: <20090512123416.GA29972@us.ibm.com> (raw)
In-Reply-To: <20090511160539.GD12286-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

This applies on top of yesterday's patchset.

thanks,
-serge

From f70a08dc6abdba372e1b3e1f25aadb919d07b171 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
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-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 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

  parent reply	other threads:[~2009-05-12 12:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 16:04 [PATCH 0/5] cr: attempt at task userid restoration Serge E. Hallyn
     [not found] ` <20090511160424.GA12234-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-05-11 16:05   ` [PATCH 1/5] cr: break out new_user_ns() Serge E. Hallyn
2009-05-11 16:05   ` [PATCH 2/5] cr: split core function out of some set*{u,g}id functions Serge E. Hallyn
2009-05-11 16:05   ` [PATCH 3/5] cr: capabilities: define checkpoint and restore fns Serge E. Hallyn
2009-05-11 16:05   ` [PATCH 4/5] cr: checkpoint and restore task credentials Serge E. Hallyn
     [not found]     ` <20090511160539.GD12286-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-05-12 12:34       ` Serge E. Hallyn [this message]
2009-05-14  8:18       ` Alexey Dobriyan
     [not found]         ` <20090514081850.GA21115-2ev+ksY9ol182hYKe6nXyg@public.gmane.org>
2009-05-14 10:52           ` Alexey Dobriyan
     [not found]             ` <20090514105252.GA31197-2ev+ksY9ol182hYKe6nXyg@public.gmane.org>
2009-05-14 13:58               ` Serge E. Hallyn
2009-05-14 13:54           ` Serge E. Hallyn
2009-05-11 16:05   ` [PATCH 5/5] cr: restore file->f_cred Serge E. Hallyn
     [not found] ` <20090511160512.GB12286-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-05-11 16:24   ` [PATCH 2/5] cr: split core function out of some set*{u, g}id functions David Howells
     [not found]     ` <22104.1242059047-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-05-11 18:08       ` [PATCH 2/5] cr: split core function out of some set*{u,g}id functions Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090512123416.GA29972@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=adobriyan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.