From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH] proc: calculate and initialize size of /proc//auxv Date: Wed, 17 Aug 2011 04:51:56 +0100 Message-ID: <20110817035156.GV2203@ZenIV.linux.org.uk> References: <4E4B334C.90000@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, harshula@redhat.com, mmitsuna@redhat.com To: Takayuki Nagata Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:56585 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751335Ab1HQDv5 (ORCPT ); Tue, 16 Aug 2011 23:51:57 -0400 Content-Disposition: inline In-Reply-To: <4E4B334C.90000@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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//* > 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.