Re: [PATCH v2 0/9] procfs: protect /proc//* 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 capabi

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

2013-10-03 Thread Julien Tinnes
On Wed, Oct 2, 2013 at 11:07 AM, Kees Cook wrote: > > On Wed, Oct 2, 2013 at 11:00 AM, Andy Lutomirski wrote: > > On Wed, Oct 2, 2013 at 10:48 AM, Kees Cook wrote: > >> On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski > >> wrote: > >>> On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni wrote: > >>

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 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 wrote: > >> >

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

2013-10-03 Thread Andy Lutomirski
On Thu, Oct 3, 2013 at 4:40 PM, Djalal Harouni 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 wrote: >> > On Thu, Oct 03, 2013 at 08:12:44AM +0200, Ingo Molnar wrote: >> >> Now procfs might be special, as by its nature o

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 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 other fi

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

2013-10-03 Thread Andy Lutomirski
On Thu, Oct 3, 2013 at 1:29 PM, Djalal Harouni wrote: > On Thu, Oct 03, 2013 at 08:12:44AM +0200, Ingo Molnar wrote: >> >> * Djalal Harouni 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 plann

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

2013-10-03 Thread Ingo Molnar
* Djalal Harouni wrote: > On Thu, Oct 03, 2013 at 08:22:56AM +0200, Ingo Molnar wrote: > > > > * Djalal Harouni 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 wor

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 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

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 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

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

2013-10-02 Thread Ingo Molnar
* Djalal Harouni 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 privileged in

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

2013-10-02 Thread Ingo Molnar
* Djalal Harouni 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, and > try t

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

2013-10-02 Thread Kees Cook
On Wed, Oct 2, 2013 at 11:48 AM, Djalal Harouni 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 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 >>

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 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 > >> wrote: > >> > On Wed, Oct 2, 2013 at 3:37 PM, Djalal Haroun

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 wrote: > > > I think revoking the fd would be great. Does that mechanism exist? > > > > There's this thing that never g

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

2013-10-02 Thread Kees Cook
On Wed, Oct 2, 2013 at 11:22 AM, Djalal Harouni 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 wrote: >> > On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni wrote: >> >> On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 wrote: > > On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski wrote: > >> On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni wrote: > >>> On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirs

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 wrote: > > On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni wrote: > >> On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski wrote: > >>> On 10/01/2013 01:26 PM, Djalal Harouni wrote: >

Re: [PATCH v2 0/9] procfs: protect /proc//* 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 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//* entries varies at runtime, appropriate pe

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

2013-10-02 Thread Kees Cook
On Wed, Oct 2, 2013 at 11:00 AM, Andy Lutomirski wrote: > On Wed, Oct 2, 2013 at 10:48 AM, Kees Cook wrote: >> On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski wrote: >>> On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni wrote: On Tue, Oct 01, 2013 at 06:40:41PM -0700, Andy Lutomirski wrote: >

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

2013-10-02 Thread Andy Lutomirski
On Wed, Oct 2, 2013 at 10:48 AM, Kees Cook wrote: > On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski wrote: >> On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni 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

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

2013-10-02 Thread Kees Cook
On Wed, Oct 2, 2013 at 9:51 AM, Andy Lutomirski wrote: > On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni 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//* entries varies at runtime, appropriate permission che

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

2013-10-02 Thread Andy Lutomirski
On Wed, Oct 2, 2013 at 3:37 PM, Djalal Harouni 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//* entries varies at runtime, appropriate permission checks >> > need to happen during each system call. >> > >> > Cu

Re: [PATCH v2 0/9] procfs: protect /proc//* 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//* entries varies at runtime, appropriate permission checks > > need to happen during each system call. > > > > Currently some of these sensitive entries are protected by perf

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

2013-10-01 Thread Andy Lutomirski
On 10/01/2013 01:26 PM, Djalal Harouni wrote: > /proc//* 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 fi

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

2013-10-01 Thread Djalal Harouni
/proc//* 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 proces