From: "Serge E. Hallyn" <serge@hallyn.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>,
Gao feng <gaofeng@cn.fujitsu.com>,
Containers <containers@lists.linux-foundation.org>,
linux-fsdevel@vger.kernel.org,
Aditya Kali <adityakali@google.com>,
Oleg Nesterov <oleg@redhat.com>,
Andy Lutomirski <luto@amacapital.net>
Subject: Re: [REVIEW][PATCH 1/3] vfs: In d_path don't call d_dname on a mount point
Date: Wed, 27 Nov 2013 01:58:15 +0000 [thread overview]
Message-ID: <20131127015815.GD31364@mail.hallyn.com> (raw)
In-Reply-To: <8738mi1yya.fsf_-_@xmission.com>
Quoting Eric W. Biederman (ebiederm@xmission.com):
>
> Aditya Kali (adityakali@google.com) wrote:
> > Commit bf056bfa80596a5d14b26b17276a56a0dcb080e5:
> > "proc: Fix the namespace inode permission checks." converted
> > the namespace files into symlinks. The same commit changed
> > the way namespace bind mounts appear in /proc/mounts:
> > $ mount --bind /proc/self/ns/ipc /mnt/ipc
> > Originally:
> > $ cat /proc/mounts | grep ipc
> > proc /mnt/ipc proc rw,nosuid,nodev,noexec 0 0
> >
> > After commit bf056bfa80596a5d14b26b17276a56a0dcb080e5:
> > $ cat /proc/mounts | grep ipc
> > proc ipc:[4026531839] proc rw,nosuid,nodev,noexec 0 0
> >
> > This breaks userspace which expects the 2nd field in
> > /proc/mounts to be a valid path.
>
> The symlink /proc/<pid>/ns/{ipc,mnt,net,pid,user,uts} point to
> dentries allocated with d_alloc_pseudo that we can mount, and
> that have interesting names printed out with d_dname.
>
> When these files are bind mounted /proc/mounts is not currently
> displaying the mount point correctly because d_dname is called instead
> of just displaying the path where the file is mounted.
>
> Solve this by adding an explicit check to distinguish mounted pseudo
> inodes and unmounted pseudo inodes. Unmounted pseudo inodes always
> use mount of their filesstem as the mnt_root in their path making
> these two cases easy to distinguish.
>
> CC: stable@vger.kernel.org
> Reported-by: Aditya Kali <adityakali@google.com>
> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> ---
> fs/dcache.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/fs/dcache.c b/fs/dcache.c
> index 4bdb300b16e2..f7282ebf1a37 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -3061,8 +3061,13 @@ char *d_path(const struct path *path, char *buf, int buflen)
> * thus don't need to be hashed. They also don't need a name until a
> * user wants to identify the object in /proc/pid/fd/. The little hack
> * below allows us to generate a name for these objects on demand:
> + *
> + * Some pseudo inodes are mountable. When they are mounted
> + * path->dentry == path->mnt->mnt_root. In that case don't call d_dname
> + * and instead have d_path return the mounted path.
> */
> - if (path->dentry->d_op && path->dentry->d_op->d_dname)
> + if (path->dentry->d_op && path->dentry->d_op->d_dname &&
> + (!IS_ROOT(path->dentry) || path->dentry != path->mnt->mnt_root))
> return path->dentry->d_op->d_dname(path->dentry, buf, buflen);
>
> rcu_read_lock();
> --
> 1.7.5.4
next prev parent reply other threads:[~2013-11-27 1:58 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20131115164123.GN28794@redhat.com>
[not found] ` <20131116164840.GA4441@mail.hallyn.com>
[not found] ` <20131117030653.GA7670@mail.hallyn.com>
[not found] ` <20131118031932.GA17621@mail.hallyn.com>
[not found] ` <52899D09.5080202@cn.fujitsu.com>
[not found] ` <20131118140830.GA22075@mail.hallyn.com>
[not found] ` <20131118180134.GA24156@mail.hallyn.com>
[not found] ` <87k3g5gnuv.fsf@xmission.com>
[not found] ` <20131126181043.GA25492@mail.hallyn.com>
[not found] ` <20131126181043.GA25492-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2013-11-27 0:14 ` [REVIEW][PATCH 0/3] userns fixes for v3.13-rc1 Eric W. Biederman
[not found] ` <87siui1z1g.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-11-27 0:16 ` [REVIEW][PATCH 1/3] vfs: In d_path don't call d_dname on a mount point Eric W. Biederman
2013-11-27 1:58 ` Serge E. Hallyn [this message]
[not found] ` <8738mi1yya.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-11-30 6:15 ` Al Viro
[not found] ` <20131130061525.GY10323-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2013-11-30 17:02 ` Al Viro
[not found] ` <20131130170226.GZ10323-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2013-11-30 21:51 ` Eric W. Biederman
[not found] ` <87a9glh838.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-11-30 22:43 ` Al Viro
[not found] ` <20131130224340.GA10323-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2013-12-02 7:29 ` Al Viro
2014-01-17 3:29 ` Eric W. Biederman
[not found] ` <874n53gub7.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2014-01-17 8:39 ` Al Viro
[not found] ` <20140117083901.GA10323-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2014-02-07 2:21 ` [PATCH 0/4] d_dname cleanups Eric W. Biederman
[not found] ` <87iosrhdc0.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2014-02-07 2:23 ` [PATCH 1/4] perfmon: Use d_alloc_pseudo like all of the d_dname callers Eric W. Biederman
2014-02-07 2:23 ` [PATCH 2/4] vfs: Simply when d_alloc_dname is called Eric W. Biederman
2014-02-07 2:24 ` [PATCH 3/4] vfs: Move the call of d_op->d_dname from d_path to prepend_path Eric W. Biederman
2014-02-07 2:24 ` [PATCH 4/4] vfs: Call d_dname from dentry_path Eric W. Biederman
2013-12-01 5:09 ` [REVIEW][PATCH 1/3] vfs: In d_path don't call d_dname on a mount point Al Viro
2013-12-01 6:15 ` [REVIEW][PATCH 1/3] vfs: In d_path don't call d_dname on a mountpoint Tetsuo Handa
2013-12-02 5:43 ` [REVIEW][PATCH 1/3] vfs: In d_path don't call d_dname on a mount point NeilBrown
[not found] ` <20131202164359.4f4f2c94-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2013-12-02 16:23 ` J.Bruce Fields
2013-11-27 0:16 ` [REVIEW][PATCH 2/3] fork: Allow CLONE_PARENT after setns(CLONE_NEWPID) Eric W. Biederman
[not found] ` <87vbzezojq.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-11-27 1:58 ` Serge E. Hallyn
2013-11-27 0:17 ` [REVIEW][PATCH 3/3] vfs: Fix a regression in mounting proc Eric W. Biederman
[not found] ` <87pppmzoin.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-11-27 0:21 ` Andy Lutomirski
[not found] ` <CALCETrVp78EfzY3Oa-LV1Hm8A4Y35apehcxrxdyrzvTb5sp=pA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-27 0:36 ` Eric W. Biederman
2013-11-27 2:00 ` Serge E. Hallyn
2013-11-27 3:19 ` Gao feng
2013-11-27 5:00 ` Eric W. Biederman
2013-11-27 16:13 ` Oleg Nesterov
[not found] ` <20131127161300.GA24773-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-27 16:29 ` Serge E. Hallyn
[not found] ` <20131127162928.GB7358-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2013-11-27 18:09 ` Oleg Nesterov
2013-11-27 16:41 ` Andy Lutomirski
[not found] ` <CALCETrXFnw63=JoEaQxM+Opj+kCXSL=9XppymzGKhLzOnp3WaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-27 18:10 ` Oleg Nesterov
2013-11-27 18:51 ` Eric W. Biederman
2013-11-27 19:47 ` Oleg Nesterov
2013-11-27 19:52 ` Eric W. Biederman
[not found] ` <87iovdmxl7.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-11-27 20:01 ` Oleg Nesterov
2013-11-27 20:07 ` Eric W. Biederman
2013-11-27 20:41 ` Andy Lutomirski
[not found] ` <CALCETrUwjK7iLMMJaCvKUbBwEqV58oXY4dWzTGJohYgg4DwjWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-29 14:56 ` Serge E. Hallyn
[not found] ` <87wqjtlic3.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-11-29 19:53 ` Oleg Nesterov
2013-12-13 22:07 ` Richard Weinberger
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=20131127015815.GD31364@mail.hallyn.com \
--to=serge@hallyn.com \
--cc=adityakali@google.com \
--cc=containers@lists.linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=gaofeng@cn.fujitsu.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=oleg@redhat.com \
/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).