|
Message-ID: <20200108103617.sowveextdxz5hkme@comp-core-i7-2640m-0182e6> Date: Wed, 8 Jan 2020 11:37:41 +0100 From: Alexey Gladkov <gladkov.alexey@...il.com> To: Alexey Dobriyan <adobriyan@...il.com> Cc: LKML <linux-kernel@...r.kernel.org>, Kernel Hardening <kernel-hardening@...ts.openwall.com>, Linux API <linux-api@...r.kernel.org>, Linux FS Devel <linux-fsdevel@...r.kernel.org>, Linux Security Module <linux-security-module@...r.kernel.org>, Akinobu Mita <akinobu.mita@...il.com>, Alexander Viro <viro@...iv.linux.org.uk>, Andrew Morton <akpm@...ux-foundation.org>, Andy Lutomirski <luto@...nel.org>, Daniel Micay <danielmicay@...il.com>, Djalal Harouni <tixxdz@...il.com>, "Dmitry V . Levin" <ldv@...linux.org>, "Eric W . Biederman" <ebiederm@...ssion.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Ingo Molnar <mingo@...nel.org>, "J . Bruce Fields" <bfields@...ldses.org>, Jeff Layton <jlayton@...chiereds.net>, Jonathan Corbet <corbet@....net>, Kees Cook <keescook@...omium.org>, Linus Torvalds <torvalds@...ux-foundation.org>, Oleg Nesterov <oleg@...hat.com>, Solar Designer <solar@...nwall.com> Subject: Re: [PATCH v6 00/10] proc: modernize proc to support multiple private instances On Mon, Jan 06, 2020 at 06:15:14PM +0300, Alexey Dobriyan wrote: > > hidepid= Set /proc/<pid>/ access mode. > > gid= Set the group authorized to learn processes information. > > + pidonly= Show only task related subset of procfs. > > I'd rather have > > mount -t proc -o set=pid This is a great idea. > so that is can be naturally extended to > > mount -t proc -o set=pid,sysctl,misc > > > +static int proc_dir_open(struct inode *inode, struct file *file) > > +{ > > + struct proc_fs_info *fs_info = proc_sb_info(inode->i_sb); > > + > > + if (proc_fs_pidonly(fs_info) == PROC_PIDONLY_ON) > > + return -ENOENT; > > + > > + return 0; > > +} > > + > > /* > > * These are the generic /proc directory operations. They > > * use the in-memory "struct proc_dir_entry" tree to parse > > @@ -338,6 +357,7 @@ static const struct file_operations proc_dir_operations = { > > .llseek = generic_file_llseek, > > .read = generic_read_dir, > > .iterate_shared = proc_readdir, > > + .open = proc_dir_open, > > This should not be necessary: if lookup and readdir filters work > then ->open can't happen. Yes you are right. > > --- a/include/linux/proc_fs.h > > +++ b/include/linux/proc_fs.h > > +/* definitions for hide_pid field */ > > +enum { > > + HIDEPID_OFF = 0, > > + HIDEPID_NO_ACCESS = 1, > > + HIDEPID_INVISIBLE = 2, > > + HIDEPID_NOT_PTRACABLE = 3, /* Limit pids to only ptracable pids */ > > +}; > > These should live in uapi/ as they _are_ user interface to mount(). OK. What do you think, maybe it's better to make these values a mask ? I mean: #define HIDEPID_OFF 0 #define HIDEPID_NO_ACCESS 1 #define HIDEPID_INVISIBLE 2 #define HIDEPID_NOT_PTRACABLE 4 In this case, if in the future there appear values that can be combined, then there will be no need to make additional parameters. -- Rgrds, legion
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.