linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Vasiliy Kulikov <segoon@openwall.com>,
	Nathan Lynch <ntl@pobox.com>, Oren Laadan <orenl@cs.columbia.edu>,
	Daniel Lezcano <dlezcano@fr.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Pavel Emelyanov <xemul@parallels.com>,
	linux-kernel@vger.kernel.org,
	James Bottomley <jbottomley@parallels.com>,
	LINUXFS-ML <linux-fsdevel@vger.kernel.org>,
	containers@lists.osdl.org, Zan Lynx <zlynx@acm.org>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [RFC] fs, proc: Introduce the /proc/<pid>/map_files/ directory v2
Date: Thu, 25 Aug 2011 19:01:47 +0200	[thread overview]
Message-ID: <20110825170147.GM2803@mtj.dyndns.org> (raw)
In-Reply-To: <20110825082944.GH10030@sun>

Hello,

On Thu, Aug 25, 2011 at 12:29:44PM +0400, Cyrill Gorcunov wrote:
>  | lr-x------ 1 cyrill cyrill 64 Aug  9 15:25 0x3d73a00000 -> /lib64/ld-2.5.so
>  | lr-x------ 1 cyrill cyrill 64 Aug  9 15:25 0x3d73c1b000 -> /lib64/ld-2.5.so
>  | lr-x------ 1 cyrill cyrill 64 Aug  9 15:25 0x3d73c1c000 -> /lib64/ld-2.5.so
>  | lr-x------ 1 cyrill cyrill 64 Aug  9 15:25 0x3d73e00000 -> /lib64/libc-2.5.so
>  | lr-x------ 1 cyrill cyrill 64 Aug  9 15:25 0x3d73f4e000 -> /lib64/libc-2.5.so

I would prefer if the filename included both start and end addresses
so that it matches the first column of /proc/PID/maps and ls'ing the
directory is more useful.  What do other people think?

> +static int map_files_d_revalidate(struct dentry *dentry, struct nameidata *nd)
> +{
> +	struct task_struct *task;
> +	struct vm_area_struct *vma;
> +	struct mm_struct *mm;
> +	struct inode *inode;
> +
> +	if (nd && nd->flags & LOOKUP_RCU)
> +		return -ECHILD;
> +
> +	inode = dentry->d_inode;
> +	task = get_proc_task(inode);
> +	if (!task)
> +		goto out;
> +
> +	mm = get_task_mm(task);
> +	put_task_struct(task);
> +	if (!mm)
> +		goto out;
> +
> +	down_read(&mm->mmap_sem);
> +	vma = find_exact_vma(mm, PROC_I(inode)->vm_start);
> +	up_read(&mm->mmap_sem);
> +	mmput(mm);
> +
> +	if (vma)
> +		return 1;

Hmm... don't we need the same credential update as
tid_fd_revalidate()?  If the task seteuid's, we want the permissions
to change accordingly, right?

Thanks.

-- 
tejun

  reply	other threads:[~2011-08-25 17:01 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24  8:53 [RFC] fs, proc: Introduce the /proc/<pid>/map_files/ directory v2 Cyrill Gorcunov
2011-08-24  9:21 ` Pekka Enberg
2011-08-24  9:33   ` Pavel Emelyanov
2011-08-24  9:34 ` Tejun Heo
2011-08-24  9:37   ` Cyrill Gorcunov
2011-08-24  9:41     ` Cyrill Gorcunov
2011-08-24 11:18 ` Vasiliy Kulikov
2011-08-24 11:31   ` Cyrill Gorcunov
2011-08-25  8:29   ` Cyrill Gorcunov
2011-08-25 17:01     ` Tejun Heo [this message]
2011-08-25 17:05       ` Pavel Emelyanov
2011-08-25 17:21         ` Cyrill Gorcunov
2011-08-25 17:25           ` Pavel Emelyanov
2011-08-25 17:27             ` Tejun Heo
2011-08-25 17:34               ` Cyrill Gorcunov
2011-08-25 17:07       ` Cyrill Gorcunov
2011-08-25 20:54         ` Tejun Heo
2011-08-25 21:12           ` Tejun Heo
2011-08-25 21:34             ` Cyrill Gorcunov
2011-08-25 21:39               ` Tejun Heo
2011-08-26  6:58                 ` Cyrill Gorcunov
2011-08-26 11:29                 ` Cyrill Gorcunov
2011-08-26 12:28                   ` Kirill A. Shutemov
2011-08-26 12:39                     ` Cyrill Gorcunov
2011-08-26 13:16                     ` Cyrill Gorcunov
2011-08-26 14:06                       ` Tejun Heo
2011-08-26 14:23                         ` Kirill A. Shutemov
2011-08-26 14:27                           ` Tejun Heo
2011-08-25 17:11       ` Cyrill Gorcunov
2011-08-25 17:36     ` Vasiliy Kulikov
2011-08-25 17:39       ` Cyrill Gorcunov
2011-08-25 17:54         ` Vasiliy Kulikov
2011-08-25 18:13           ` Cyrill Gorcunov
2011-08-24 15:05 ` Zan Lynx
2011-08-24 15:19   ` Pavel Emelyanov
2011-08-24 17:36     ` Andi Kleen
2011-08-25  6:42       ` Pavel Emelyanov
2011-08-25 14:04         ` Andi Kleen
2011-08-25 14:30           ` Cyrill Gorcunov
2011-08-25 14:47           ` Pavel Emelyanov
2011-08-24 15:22   ` Cyrill Gorcunov
2011-09-13 14:14 ` Pavel Machek
2011-09-13 14:20   ` Pavel Emelyanov

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=20110825170147.GM2803@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=containers@lists.osdl.org \
    --cc=dlezcano@fr.ibm.com \
    --cc=gorcunov@gmail.com \
    --cc=jbottomley@parallels.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntl@pobox.com \
    --cc=orenl@cs.columbia.edu \
    --cc=segoon@openwall.com \
    --cc=xemul@parallels.com \
    --cc=zlynx@acm.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;
as well as URLs for NNTP newsgroup(s).