From: David Howells <dhowells@redhat.com>
To: viro@zeniv.linux.org.uk
Cc: Andrei Vagin <avagin@gmail.com>,
dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] proc: Set correct userns for new proc super created by a new pid_namespace
Date: Tue, 21 Aug 2018 10:55:37 +0100 [thread overview]
Message-ID: <153484533695.1183.7796797839895873922.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <153484529922.1183.17405985592221413059.stgit@warthog.procyon.org.uk>
From: Andrei Vagin <avagin@openvz.org>
Fix the setting up a new proc superblock for a new pid_namespace such that
the user_ns for that proc superblock needs to be taken from the new
pid_namespace and not the active process.
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.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);
prev parent reply other threads:[~2018-08-21 9:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-21 9:54 vfs: Fixes/adjustments for mount API stuff David Howells
2018-08-21 9:55 ` [PATCH 1/6] vfs: Fix vfs_dup_fs_context() David Howells
2018-08-21 9:55 ` [PATCH 2/6] vfs: Fix fs_context logging when there's no log David Howells
2018-08-21 9:55 ` [PATCH 3/6] afs: Move the source fs parameter to the first position David Howells
2018-08-21 9:55 ` [PATCH 4/6] vfs: Pass path info fsinfo and rename get_fsinfo sb op to fsinfo David Howells
2018-08-21 9:55 ` [PATCH 5/6] vfs: Adjust fsinfo sample output David Howells
2018-08-21 9:55 ` David Howells [this message]
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=153484533695.1183.7796797839895873922.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=avagin@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).