[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrUte7WRMi23+rp+XbgAoOcw=TPZe02YEuZRZyVroj+mfQ@mail.gmail.com>
Date: Mon, 26 May 2014 09:57:16 -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 1/9] procfs: use flags to deny or allow access to /proc/<pid>/$entry
On Mon, May 26, 2014 at 6:27 AM, Djalal Harouni <tixxdz@...ndz.org> wrote:
> Add the deny or allow flags, so we can perform proper permission checks
> and set the result accordingly. These flags are needed in case we have
> to cache the result of permission checks that are done during ->open()
> time. Later during ->read(), we can decide to allow or deny the read().
>
> The pid entries that need these flags are:
> /proc/<pid>/stat
> /proc/<pid>/wchan
> /proc/<pid>/maps (will be handled in next patches).
>
> These files are world readable, userspace depend on that. To prevent
> ASLR leaks and to avoid breaking userspace, we follow this scheme:
>
> a) Perform permission checks during ->open()
> b) Cache the result of a) and return success
> c) Recheck the cached result during ->read()
Why is (c) needed?
>
> /*
> + * Flags used to deny or allow current to access /proc/<pid>/$entry
> + * after proper permission checks.
> + */
> +enum {
> + PID_ENTRY_DENY = 0, /* Deny access */
> + PID_ENTRY_ALLOW = 1, /* Allow access */
> +};
I think this would be less alarming if this were:
#define PID_ENTRY_DENY ((void *)1UL)
#define PID_ENTRY_ALLOW ((void *)2UL)
Also, I don't like DENY and ALLOW. It's not denying and allowing.
How about PID_ENTRY_OPENER_MAY_PTRACE and
PID_ENTRY_OPENER_MAY_NOT_PTRACE?
--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