All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Andrei Vagin <avagin@openvz.org>
Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
	Andrei Vagin <avagin@gmail.com>,
	Eric Biederman <ebiederm@xmission.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH dhowells/mount-api] proc: set a proper user namespace for fs_context
Date: Tue, 21 Aug 2018 08:33:26 +0100	[thread overview]
Message-ID: <561.1534836806@warthog.procyon.org.uk> (raw)
In-Reply-To: <20180816073407.12567-1-avagin@openvz.org>

Andrei Vagin <avagin@openvz.org> wrote:

> A user namespace should be taken from a pidns for which a procfs is created.

That would seem wrong.  Shouldn't the superblock user_ns be from the mounter?

Adding Al and Eric to the list to get their opinion.

David

> Signed-off-by: Andrei Vagin <avagin@gmail.com>
> ---
>  fs/proc/root.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/fs/proc/root.c b/fs/proc/root.c
> index 1d6e5bfa30cc..1419b48a89ab 100644
> --- a/fs/proc/root.c
> +++ b/fs/proc/root.c
> @@ -315,6 +315,11 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)
>  	if (IS_ERR(fc))
>  		return PTR_ERR(fc);
>  
> +	if (fc->user_ns != ns->user_ns) {
> +		put_user_ns(fc->user_ns);
> +		fc->user_ns = get_user_ns(ns->user_ns);
> +	}
> +
>  	ctx = fc->fs_private;
>  	if (ctx->pid_ns != ns) {
>  		put_pid_ns(ctx->pid_ns);

  parent reply	other threads:[~2018-08-21 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16  7:34 [PATCH dhowells/mount-api] proc: set a proper user namespace for fs_context Andrei Vagin
2018-08-16 22:16 ` Andrei Vagin
2018-08-21  7:33 ` David Howells [this message]
2018-08-21  7:39   ` David Howells

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=561.1534836806@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=avagin@gmail.com \
    --cc=avagin@openvz.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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.