Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-04 Thread Djalal Harouni
On Thu, Oct 03, 2013 at 08:12:44AM +0200, Ingo Molnar wrote: So please first get consensus on this fundamental design question before spreading your solution to more areas. Check file_ns_capable() added in commit 935d8aabd4331 by Linus Add file_ns_capable() helper function for open-time

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Ingo Molnar
* Djalal Harouni tix...@opendz.org wrote: Regardless, glibc uses /proc/self/maps, which would be fine here, right? I did not touch /proc/self/maps and others, but I'm planning to fix them if this solution is accepted. I'll do the same thing as in /proc/*/stat for maps, let it be 0444,

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Ingo Molnar
* Djalal Harouni tix...@opendz.org wrote: * You can't do it for /proc/*/stat otherwise you will break userspace ps..., ps must access /proc/1/stat etc... so the proposed solution will work without any side effect. The thing is, returning -EINVAL is not the only way to reject access to

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Djalal Harouni
On Thu, Oct 03, 2013 at 08:12:44AM +0200, Ingo Molnar wrote: * Djalal Harouni tix...@opendz.org wrote: Regardless, glibc uses /proc/self/maps, which would be fine here, right? I did not touch /proc/self/maps and others, but I'm planning to fix them if this solution is accepted.

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Djalal Harouni
On Thu, Oct 03, 2013 at 08:22:56AM +0200, Ingo Molnar wrote: * Djalal Harouni tix...@opendz.org wrote: * You can't do it for /proc/*/stat otherwise you will break userspace ps..., ps must access /proc/1/stat etc... so the proposed solution will work without any side effect. The

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Ingo Molnar
* Djalal Harouni tix...@opendz.org wrote: On Thu, Oct 03, 2013 at 08:22:56AM +0200, Ingo Molnar wrote: * Djalal Harouni tix...@opendz.org wrote: * You can't do it for /proc/*/stat otherwise you will break userspace ps..., ps must access /proc/1/stat etc... so the proposed

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Andy Lutomirski
On Thu, Oct 3, 2013 at 1:29 PM, Djalal Harouni tix...@opendz.org wrote: On Thu, Oct 03, 2013 at 08:12:44AM +0200, Ingo Molnar wrote: * Djalal Harouni tix...@opendz.org wrote: Regardless, glibc uses /proc/self/maps, which would be fine here, right? I did not touch /proc/self/maps and

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Djalal Harouni
On Thu, Oct 03, 2013 at 04:15:43PM +0100, Andy Lutomirski wrote: On Thu, Oct 3, 2013 at 1:29 PM, Djalal Harouni tix...@opendz.org wrote: On Thu, Oct 03, 2013 at 08:12:44AM +0200, Ingo Molnar wrote: Now procfs might be special, as by its nature of a pseudofilesystem it's far more atomic than

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Andy Lutomirski
On Thu, Oct 3, 2013 at 4:40 PM, Djalal Harouni tix...@opendz.org wrote: On Thu, Oct 03, 2013 at 04:15:43PM +0100, Andy Lutomirski wrote: On Thu, Oct 3, 2013 at 1:29 PM, Djalal Harouni tix...@opendz.org wrote: On Thu, Oct 03, 2013 at 08:12:44AM +0200, Ingo Molnar wrote: Now procfs might be

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Djalal Harouni
(Andy sorry for the delay, real life...) On Thu, Oct 03, 2013 at 04:50:54PM +0100, Andy Lutomirski wrote: On Thu, Oct 3, 2013 at 4:40 PM, Djalal Harouni tix...@opendz.org wrote: On Thu, Oct 03, 2013 at 04:15:43PM +0100, Andy Lutomirski wrote: On Thu, Oct 3, 2013 at 1:29 PM, Djalal Harouni

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-03 Thread Julien Tinnes
On Wed, Oct 2, 2013 at 11:07 AM, Kees Cook keesc...@chromium.org wrote: On Wed, Oct 2, 2013 at 11:00 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013 at 10:48 AM, Kees Cook keesc...@chromium.org wrote: On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski l...@amacapital.net

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Djalal Harouni
On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski wrote: On 10/01/2013 01:26 PM, Djalal Harouni wrote: /proc/pid/* entries varies at runtime, appropriate permission checks need to happen during each system call. Currently some of these sensitive entries are protected by

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Andy Lutomirski
On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni tix...@opendz.org wrote: On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski wrote: On 10/01/2013 01:26 PM, Djalal Harouni wrote: /proc/pid/* entries varies at runtime, appropriate permission checks need to happen during each system call.

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Kees Cook
On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni tix...@opendz.org wrote: On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski wrote: On 10/01/2013 01:26 PM, Djalal Harouni wrote: /proc/pid/* entries varies at

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Andy Lutomirski
On Wed, Oct 2, 2013 at 10:48 AM, Kees Cook keesc...@chromium.org wrote: On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni tix...@opendz.org wrote: On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski wrote: On

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Kees Cook
On Wed, Oct 2, 2013 at 11:00 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013 at 10:48 AM, Kees Cook keesc...@chromium.org wrote: On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni tix...@opendz.org wrote:

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Djalal Harouni
On Wed, Oct 02, 2013 at 05:51:15PM +0100, Andy Lutomirski wrote: On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni tix...@opendz.org wrote: On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski wrote: On 10/01/2013 01:26 PM, Djalal Harouni wrote: /proc/pid/* entries varies at runtime,

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Djalal Harouni
On Wed, Oct 02, 2013 at 10:48:55AM -0700, Kees Cook wrote: On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni tix...@opendz.org wrote: On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski wrote: On 10/01/2013 01:26

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Djalal Harouni
On Wed, Oct 02, 2013 at 11:00:26AM -0700, Andy Lutomirski wrote: On Wed, Oct 2, 2013 at 10:48 AM, Kees Cook keesc...@chromium.org wrote: On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni tix...@opendz.org wrote: On Tue,

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Kees Cook
On Wed, Oct 2, 2013 at 11:22 AM, Djalal Harouni tix...@opendz.org wrote: On Wed, Oct 02, 2013 at 10:48:55AM -0700, Kees Cook wrote: On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni tix...@opendz.org wrote: On Tue, Oct

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Djalal Harouni
On Wed, Oct 02, 2013 at 07:26:43PM +0100, Djalal Harouni wrote: On Wed, Oct 02, 2013 at 11:00:26AM -0700, Andy Lutomirski wrote: On Wed, Oct 2, 2013 at 10:48 AM, Kees Cook keesc...@chromium.org wrote: I think revoking the fd would be great. Does that mechanism exist? There's this thing

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Djalal Harouni
On Wed, Oct 02, 2013 at 11:35:45AM -0700, Kees Cook wrote: On Wed, Oct 2, 2013 at 11:22 AM, Djalal Harouni tix...@opendz.org wrote: On Wed, Oct 02, 2013 at 10:48:55AM -0700, Kees Cook wrote: On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski l...@amacapital.net wrote: On Wed, Oct 2, 2013

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-02 Thread Kees Cook
On Wed, Oct 2, 2013 at 11:48 AM, Djalal Harouni tix...@opendz.org wrote: On Wed, Oct 02, 2013 at 11:35:45AM -0700, Kees Cook wrote: On Wed, Oct 2, 2013 at 11:22 AM, Djalal Harouni tix...@opendz.org wrote: On Wed, Oct 02, 2013 at 10:48:55AM -0700, Kees Cook wrote: On Wed, Oct 2, 2013 at 9:51

[PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-01 Thread Djalal Harouni
/proc/pid/* entries varies at runtime, appropriate permission checks need to happen during each system call. Currently some of these sensitive entries are protected by performing the ptrace_may_access() check. However even with that the /proc file descriptors can be passed to a more privileged

Re: [PATCH v2 0/9] procfs: protect /proc/pid/* files with file-f_cred

2013-10-01 Thread Andy Lutomirski
On 10/01/2013 01:26 PM, Djalal Harouni wrote: /proc/pid/* entries varies at runtime, appropriate permission checks need to happen during each system call. Currently some of these sensitive entries are protected by performing the ptrace_may_access() check. However even with that the /proc