From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59406 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726253AbeHUKw3 (ORCPT ); Tue, 21 Aug 2018 06:52:29 -0400 From: David Howells In-Reply-To: <20180816073407.12567-1-avagin@openvz.org> References: <20180816073407.12567-1-avagin@openvz.org> To: Andrei Vagin Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org, Andrei Vagin , Eric Biederman , Alexander Viro Subject: Re: [PATCH dhowells/mount-api] proc: set a proper user namespace for fs_context MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <560.1534836806.1@warthog.procyon.org.uk> Date: Tue, 21 Aug 2018 08:33:26 +0100 Message-ID: <561.1534836806@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Andrei Vagin 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 > --- > 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);