linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Takayuki Nagata <tnagata@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, harshula@redhat.com, mmitsuna@redhat.com
Subject: Re: [PATCH] proc: calculate and initialize size of /proc/<PID>/auxv
Date: Wed, 17 Aug 2011 04:51:56 +0100	[thread overview]
Message-ID: <20110817035156.GV2203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <4E4B334C.90000@redhat.com>

On Wed, Aug 17, 2011 at 12:19:40PM +0900, Takayuki Nagata wrote:
> An ls and a wc commands show 0 size for some of /proc/<PID>/*
> files, because getattr methods and inode->i_size variables
> are not implemented for these files. These files are known
> pseudo, but some peoples may need size of the files.

"Some people may need" is far to vague...

> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=155943

Containing unanswered question by mingo, again along the lines of "WTF is
that needed at all?"...

> +static int proc_pid_auxv(struct task_struct *task, char *buffer)
> +{
> +	int size;
> +	struct mm_struct *mm = get_task_mm(task);
> +	size = count_mm_saved_auxv(mm);
> +	if (mm) {
> +		if(buffer)
> +			memcpy(buffer, mm->saved_auxv, size);
> +		mmput(mm);
> +	}

Oh, lovely - so we are allowing anybody to read it, suid exec be damned.

> +static loff_t proc_pid_auxv_isize(struct task_struct *task)
> +{
> +	struct mm_struct *mm = get_task_mm(task);
> +	return count_mm_saved_auxv(mm);

... and that simply leaks.

> +static int proc_pid_auxv_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
> +{
> +	struct inode *inode = dentry->d_inode;
> +	struct task_struct *task = get_proc_task(inode);
> +	struct mm_struct *mm = get_task_mm(task);
> +
> +	generic_fillattr(inode, stat);
> +	stat->size = count_mm_saved_auxv(mm);

... and so does this, both mm and task.

Ancient bz entry with unanswered objections in it, broken patch, no
rationale in sight... NAK with extreme prejudice.

      reply	other threads:[~2011-08-17  3:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-17  3:19 [PATCH] proc: calculate and initialize size of /proc/<PID>/auxv Takayuki Nagata
2011-08-17  3:51 ` Al Viro [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=20110817035156.GV2203@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=harshula@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mmitsuna@redhat.com \
    --cc=tnagata@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).