From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: [PATCH RFC 1/4] proc: add proc_fs_info struct to store proc options Date: Thu, 30 Mar 2017 12:10:44 -0700 Message-ID: References: <1490887379-25880-1-git-send-email-tixxdz@gmail.com> <1490887379-25880-2-git-send-email-tixxdz@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <1490887379-25880-2-git-send-email-tixxdz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Djalal Harouni Cc: Linux Kernel Mailing List , Andy Lutomirski , Alexey Gladkov , Al Viro , "Eric W. Biederman" , Andrew Morton , Linux API , "Kirill A. Shutemov" , Oleg Nesterov , Pavel Emelyanov , James Bottomley , Kees Cook , Dongsu Park , Ingo Molnar , Michal Hocko , Alexey Dobriyan , "kernel-hardening-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org" , LSM List List-Id: linux-api@vger.kernel.org On Thu, Mar 30, 2017 at 8:22 AM, Djalal Harouni wrote: > This is a preparation patch that adds a proc_fs_info to be able to store > different procfs options. Right now some mount options are stored inside > the pid namespace which make multiple proc share the same mount options. > This patch will help also to fix this. > > Signed-off-by: Djalal Harouni > static struct dentry *proc_mount(struct file_system_type *fs_type, > int flags, const char *dev_name, void *data) > { > + int error; > + struct super_block *sb; > struct pid_namespace *ns; > + struct proc_fs_info *fs_info; > + > + if (!(flags & MS_KERNMOUNT) && !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) > + return ERR_PTR(-EPERM); Why is this check needed? > diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h > index 2d2bf59..e1cb9c3 100644 > --- a/include/linux/proc_fs.h > +++ b/include/linux/proc_fs.h > @@ -6,11 +6,27 @@ > > #include > #include > +#include > + > +enum { > + PROC_FS_V1 = 1, > + PROC_FS_V2 = 2, > +}; > + > +struct proc_fs_info { > + refcount_t users; > + struct pid_namespace *pid_ns; > + kgid_t pid_gid; > + int hide_pid; > + int version; > +}; What is version? Should this patch have just users and pid_ns and move the other stuff to patch 2?