Linux Container Development
 help / color / mirror / Atom feed
From: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	Linux Containers
	<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	"Eric W. Biederman"
	<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 1/1] User namespaces: fix refcounting
Date: Wed, 08 Oct 2008 18:53:23 +0100	[thread overview]
Message-ID: <27300.1223488403@redhat.com> (raw)
In-Reply-To: <20081008144246.GA26362-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> wrote:

> Perhaps the most objectionable part of this to you may be the
> __task_commit_creds().

You're right, that looks pretty yuck.  I'm not sure why you need to do this.

I need to think about it a bit more, but I think you shouldn't be calling
[__task_]commit_creds() on any task that's not your own.

In fact, do you need to call commit_creds() on the new task?  No-one else can
have seen it yet, so RCU can be ignored; and no-one knows about it yet, so
calling proc_id_connector() is unnecessary.

The obvious thing to do would be to make copy_creds() handle the user namespace
copying.


A couple of quick other comments:

> @@ -595,6 +595,7 @@ struct user_struct {
>  	/* Hash table maintenance information */
>  	struct hlist_node uidhash_node;
>  	uid_t uid;
> +	struct user_namespace *user_ns;

Is asking for a circular dependency.  user_namespace must hold a dependency on
its the user_struct pointed to by root_user, but root_user holds a ref on
user_ns.

> +	.creator = &root_user,

Probably means that you should increment the initial usage count on root_user.

David

  parent reply	other threads:[~2008-10-08 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-08 14:42 [PATCH 1/1] User namespaces: fix refcounting Serge E. Hallyn
     [not found] ` <20081008144246.GA26362-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-10-08 17:53   ` David Howells [this message]
     [not found]     ` <27300.1223488403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-10-08 20:02       ` 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=27300.1223488403@redhat.com \
    --to=dhowells-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=serue-r/Jw6+rmf7HQT0dZR+AlfA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox