From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH] proc: make proc_fd_permission() thread-friendly Date: Tue, 27 Aug 2013 16:53:45 +0200 Message-ID: <20130827145345.GC19425@redhat.com> References: <20130825065039.GB9299@1wt.eu> <20130825194844.GA16717@redhat.com> <20130826153301.GA15890@redhat.com> <20130826163704.GA21763@redhat.com> <20130826175441.GA28856@redhat.com> <87ioyspaju.fsf@xmission.com> <20130826184631.GA30917@redhat.com> <8738pwp8tj.fsf@xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andrew Morton , Willy Tarreau , Al Viro , Andy Lutomirski , Ingo Molnar , Linux Kernel Mailing List , Linux FS Devel , Brad Spengler , Linus Torvalds To: "Eric W. Biederman" Return-path: Content-Disposition: inline In-Reply-To: <8738pwp8tj.fsf@xmission.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 08/26, Eric W. Biederman wrote: > > Oleg Nesterov writes: > > > > And I also assume that you agree with this change ;) > > I don't disagree. Comparing tgid to pids is goofy and my brain is > elsewhere so I have no thought through the implications. > > Actually thinking I think the check should really be. In which case we > are comparing what we really care about. > > int proc_fd_permission(struct inode *inode, int mask) > { > int rv = generic_permission(inode, mask); > if (rv == 0) > return 0; > > rcu_read_lock(); > struct task *task = pid_task(proc_pid(inode)); > if (task && (current->files == task->files)) But for what? To me, this looks like the unnecessary semantic complication. It looks as if we actually need to restrict the access to /proc/self/fd or /proc//fd or /proc//fd. I do not think there is any security reason to deny this. They share ->mm, a sub-thread can do "everything" with its leader or vice versa. same_thread_group() looks more simple and natural to me. And note that __ptrace_may_access() was recently changed (in -mm) to use same_thread_group() instead of "task == current". So personally I'd prefer to not change this patch and I think it makes sense even with "make /proc/self point to thread" I sent. But. please tell me if you really dislike it. You are maintainer, I won't argue. Oleg.