From: Djalal Harouni <tixxdz@opendz.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux FS Devel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 6/9] procfs: add pid_seq_private struct to handle /proc/<pid>/{stat|stack}
Date: Tue, 27 May 2014 12:18:06 +0100 [thread overview]
Message-ID: <20140527111806.GA3148@dztty> (raw)
In-Reply-To: <CALCETrU71gJ-cUL8YO8UeYdG65A0=z4BJQuga-hbd1WgeTFE+A@mail.gmail.com>
On Mon, May 26, 2014 at 10:02:15AM -0700, Andy Lutomirski wrote:
> On Mon, May 26, 2014 at 6:27 AM, Djalal Harouni <tixxdz@opendz.org> wrote:
> > This patch is preparation to handle sensitive ONE entries:
> > /proc/<pid>/stat
> > /proc/<pid>/stack
> >
> > These files use sequence iterators and we want to keep that logic, and
> > their internal handler semantics.
> >
> > The sequence iterators stock the inode in the seq_file->private field,
> > so in order to keep the semantic and to make the cached permission
> > checks available during ->read(), we add the 'pid_seq_private' struct
> > that contains both the inode and the cached permission. It will be the
> > one referenced in the seq_file->private.
> >
> > This way the internal handlers of /proc/<pid>/{stat|stack} wont change.
> >
> > Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
> > ---
> > fs/proc/internal.h | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/fs/proc/internal.h b/fs/proc/internal.h
> > index f5c452c..f28e4f01 100644
> > --- a/fs/proc/internal.h
> > +++ b/fs/proc/internal.h
> > @@ -78,6 +78,17 @@ struct proc_inode {
> > struct inode vfs_inode;
> > };
> >
> > +/*
> > + * Struct used by some /proc/<pid>/$entries that use sequence
> > + * iterators.
> > + * This struct will be saved in seq_file->private so seq handlers
> > + * can access the inode and the cached permission checks of ->open().
> > + */
> > +struct pid_seq_private {
> > + int permitted;
> > + struct inode *inode;
> > +};
> > +
> > typedef int (*proc_read_fn_t)(char *page,
> > struct task_struct *task, int permitted);
>
> int opener_may_ptrace, please.
Ok, I'll change it in v2.
Thanks
--
Djalal Harouni
http://opendz.org
next prev parent reply other threads:[~2014-05-27 11:18 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 13:27 [PATCH 0/9] procfs: smooth steps to secure some /proc/<pid>/* Djalal Harouni
2014-05-26 13:27 ` [PATCH 1/9] procfs: use flags to deny or allow access to /proc/<pid>/$entry Djalal Harouni
2014-05-26 16:57 ` Andy Lutomirski
2014-05-26 17:21 ` Djalal Harouni
2014-05-26 18:06 ` Andy Lutomirski
2014-05-26 19:13 ` Djalal Harouni
2014-05-26 19:17 ` Andy Lutomirski
2014-05-27 13:42 ` Djalal Harouni
2014-05-27 18:38 ` Kees Cook
2014-05-28 11:42 ` Djalal Harouni
2014-05-28 16:59 ` Kees Cook
2014-05-28 19:11 ` Djalal Harouni
2014-05-26 13:27 ` [PATCH 2/9] procfs: add pid_entry_access() for proper checks on /proc/<pid>/* Djalal Harouni
2014-05-26 16:57 ` Andy Lutomirski
2014-05-26 13:27 ` [PATCH 3/9] procfs: add proc_read_from_buffer() and pid_entry_read() helpers Djalal Harouni
2014-05-26 17:01 ` Andy Lutomirski
2014-05-26 17:41 ` Djalal Harouni
2014-05-26 17:59 ` Andy Lutomirski
2014-05-26 18:21 ` Djalal Harouni
2014-05-26 18:44 ` Djalal Harouni
2014-06-03 10:13 ` Alexey Dobriyan
2014-05-26 13:27 ` [PATCH 4/9] procfs: improve /proc/<pid>/wchan protection Djalal Harouni
2014-05-26 13:27 ` [PATCH 5/9] procfs: improve /proc/<pid>/syscall protection Djalal Harouni
2014-05-26 13:27 ` [PATCH 6/9] procfs: add pid_seq_private struct to handle /proc/<pid>/{stat|stack} Djalal Harouni
2014-05-26 17:02 ` Andy Lutomirski
2014-05-27 11:18 ` Djalal Harouni [this message]
2014-05-26 13:27 ` [PATCH 7/9] procfs: add pid_entry_show() helper " Djalal Harouni
2014-05-26 13:27 ` [PATCH 8/9] procfs: improve /proc/<pid>/stat protection Djalal Harouni
2014-05-26 13:27 ` [PATCH 9/9] procfs: improve /proc/<pid>/stack protection Djalal Harouni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140527111806.GA3148@dztty \
--to=tixxdz@opendz.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).