[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrU+O+p_EYao1k6y0t6JnJ+sV97zAGkn=enuJPEzpcW_Wg@mail.gmail.com>
Date: Mon, 26 May 2014 10:01:20 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Djalal Harouni <tixxdz@...ndz.org>
Cc: Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexey Dobriyan <adobriyan@...il.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Al Viro <viro@...iv.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
Oleg Nesterov <oleg@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux FS Devel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH 3/9] procfs: add proc_read_from_buffer() and
pid_entry_read() helpers
On Mon, May 26, 2014 at 6:27 AM, Djalal Harouni <tixxdz@...ndz.org> wrote:
> This patch is preparation, it adds a couple of helpers to read data and
> to get the cached permission checks during that ->read().
>
> Currently INF entries share the same code, they do not implement
> specific ->open(), only ->read() coupled with callback calls. Doing
> permission checks during ->open() will not work and will only disturb
> the INF entries that do not need permission checks. Yes not all the INF
> entries need checks, the ones that need protections are listed below:
> /proc/<pid>/wchan
> /proc/<pid>/syscall
> /proc/<pid>/{auxv,io} (will be handled in next patches).
>
> So to have proper permission checks convert this INF entries to REG
> entries and use their open() and read() handlers to implement these
> checks. To achieve this we add the following helpers:
>
> * proc_read_from_buffer() a wrapper around simple_read_from_buffer(), it
> makes sure that count <= PROC_BLOCK_SIZE (3*1024)
>
> * pid_entry_read(): it will get a free page and pass it to the specific
> /proc/<pid>/$entry handler (callback). The handler is of the same
> types of the previous INF handlers, it will only receive an extra
> "permitted" argument that contains the cached permission check that
> was performed during ->open().
>
> The handler is of type:
> typedef int (*proc_read_fn_t)(char *page,
> struct task_struct *task, int permitted);
[...]
This strikes me as *way* too complicated. Why not just change
proc_info_file_operations to *always* cache may_ptrace on open?
FWIW, it's been awhile: was anything actually wrong with using f_cred,
other than the fact that it would have required adjusting the LSM
hooks?
Admittedly, I don't see anything fundamentally wrong with caching
may_ptrace on open as long as revoke in in the cards eventually, but
it's plausible that a good f_cred-based implementation would make
revoke less necessary.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists