From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755258AbbBLHpt (ORCPT ); Thu, 12 Feb 2015 02:45:49 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:64090 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750902AbbBLHpr (ORCPT ); Thu, 12 Feb 2015 02:45:47 -0500 Date: Thu, 12 Feb 2015 10:45:44 +0300 From: Cyrill Gorcunov To: Calvin Owens Cc: "Kirill A. Shutemov" , Andrew Morton , Alexey Dobriyan , Oleg Nesterov , "Eric W. Biederman" , Al Viro , "Kirill A. Shutemov" , Peter Feiner , Grant Likely , Siddhesh Poyarekar , linux-kernel@vger.kernel.org, kernel-team@fb.com, Pavel Emelyanov Subject: Re: [RFC][PATCH v3] procfs: Always expose /proc//map_files/ and make it readable Message-ID: <20150212074544.GV2253@moon> References: <1421194829-28696-1-git-send-email-calvinowens@fb.com> <20150114152501.GB9820@node.dhcp.inet.fi> <20150114153323.GF2253@moon> <20150114204653.GA26698@mail.thefacebook.com> <20150114211613.GH2253@moon> <20150122024554.GB23762@mail.thefacebook.com> <20150124031544.GA1992748@mail.thefacebook.com> <20150212022910.GA3247638@mail.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150212022910.GA3247638@mail.thefacebook.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 11, 2015 at 06:29:10PM -0800, Calvin Owens wrote: > Currently, /proc//map_files/ is restricted to CAP_SYS_ADMIN, and is > only exposed if CONFIG_CHECKPOINT_RESTORE is set. This interface is > useful for enumerating the files mapped into a process when the more > verbose information in /proc//maps is not needed. It also allows > access to file descriptors for files that have been deleted and closed > but are still mmapped into a process, which can be very useful for > introspection and debugging. ... > > +/* > + * Enforce stronger PTRACE_MODE_ATTACH permissions on the symlinks under > + * /proc//map_files, since these links may refer to deleted or O_TMPFILE > + * files that users might assume are inaccessible regardless of their > + * ownership/permissions. > + */ > +static void *proc_map_files_follow_link(struct dentry *dentry, struct nameidata *nd) > +{ > + struct inode *inode = dentry->d_inode; > + struct task_struct *task; > + int allowed = 0; > + > + task = get_proc_task(inode); > + if (task) { > + allowed = ptrace_may_access(task, PTRACE_MODE_ATTACH); > + put_task_struct(task); > + } else return ERR_PTR(-ESRCH); Other than that, looks good to me, thanks! Rewieved-by: Cyrill Gorcunov