From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: /proc/pid/fd && anon_inode_fops Date: Mon, 26 Aug 2013 18:37:04 +0200 Message-ID: <20130826163704.GA21763@redhat.com> References: <20130822201530.GL31117@1wt.eu> <20130824182939.GA23630@redhat.com> <20130824212432.GA9299@1wt.eu> <20130825052317.GZ27005@ZenIV.linux.org.uk> <20130825065039.GB9299@1wt.eu> <20130825194844.GA16717@redhat.com> <20130826153301.GA15890@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Willy Tarreau , Al Viro , Andy Lutomirski , "security@kernel.org" , Ingo Molnar , Linux Kernel Mailing List , Linux FS Devel , Brad Spengler To: Linus Torvalds Return-path: Content-Disposition: inline In-Reply-To: <20130826153301.GA15890@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 08/26, Oleg Nesterov wrote: > > Not sure we really want this in this case but > > $ ./ls /proc/self/fd > 0 1 2 3 > > still works, I guess thanks to proc_fd_permission(). And btw. Whatever we do, shouldn't we change proc_fd_permission()? /proc/self is actually /proc/tgid, this means that the task_pid() check can't help if a sub-thread uses /proc/self. Oleg. --- x/fs/proc/fd.c +++ x/fs/proc/fd.c @@ -288,7 +288,7 @@ int proc_fd_permission(struct inode *ino int rv = generic_permission(inode, mask); if (rv == 0) return 0; - if (task_pid(current) == proc_pid(inode)) + if (task_tgid(current) == proc_pid(inode)) rv = 0; return rv; }