public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Can access to /proc/$PID/exe be relaxed?
@ 2009-07-21 16:52 Lennart Poettering
  2009-07-21 17:06 ` Denys Vlasenko
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Poettering @ 2009-07-21 16:52 UTC (permalink / raw)
  To: linux-kernel

Hi!

Unless I am mistaken a process currently needs CAP_SYS_PTRACE to read
/proc/$PID/exe for abritrary processes. Does that make sense? Could
that be relaxed? Is there any reason to limit access to that link at
all? To me the data from /proc/$PID/cmdline seems to be far more
worthy to be protected than /proc/$PID/exe, or am I missing something?

Tbh, looking at the code I don't really get where CAP_SYS_PTRACE seems
to be required, but experimenting from userspace this seems to be the
case.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can access to /proc/$PID/exe be relaxed?
  2009-07-21 16:52 Can access to /proc/$PID/exe be relaxed? Lennart Poettering
@ 2009-07-21 17:06 ` Denys Vlasenko
  2009-07-21 17:17   ` Lennart Poettering
  0 siblings, 1 reply; 3+ messages in thread
From: Denys Vlasenko @ 2009-07-21 17:06 UTC (permalink / raw)
  To: Lennart Poettering; +Cc: linux-kernel

On Tue, Jul 21, 2009 at 6:52 PM, Lennart Poettering<mzxreary@0pointer.de> wrote:
> Hi!
>
> Unless I am mistaken a process currently needs CAP_SYS_PTRACE to read
> /proc/$PID/exe for abritrary processes.

You mean "readlink'?

> Does that make sense? Could
> that be relaxed? Is there any reason to limit access to that link at
> all? To me the data from /proc/$PID/cmdline seems to be far more
> worthy to be protected than /proc/$PID/exe, or am I missing something?
>
> Tbh, looking at the code I don't really get where CAP_SYS_PTRACE seems
> to be required, but experimenting from userspace this seems to be the
> case.

Another annoying thing is that sometimes processes cannot open
their own /proc/self/fd/N. Example:

# setuidgid 200:200 cat /proc/self/fd/0
cat: /proc/self/fd/0: Permission denied

In real life this happened when I wanted to redirect apache's
log to stderr. The config directive only allowed redirecting
to a file, so I specified /proc/self/fd/2. It does not work
if apache drops root after startup.

--
vda

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Can access to /proc/$PID/exe be relaxed?
  2009-07-21 17:06 ` Denys Vlasenko
@ 2009-07-21 17:17   ` Lennart Poettering
  0 siblings, 0 replies; 3+ messages in thread
From: Lennart Poettering @ 2009-07-21 17:17 UTC (permalink / raw)
  To: Denys Vlasenko; +Cc: linux-kernel

On Tue, 21.07.09 19:06, Denys Vlasenko (vda.linux@googlemail.com) wrote:

> 
> On Tue, Jul 21, 2009 at 6:52 PM, Lennart Poettering<mzxreary@0pointer.de> wrote:
> > Hi!
> >
> > Unless I am mistaken a process currently needs CAP_SYS_PTRACE to read
> > /proc/$PID/exe for abritrary processes.
> 
> You mean "readlink'?

Yes.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-21 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-21 16:52 Can access to /proc/$PID/exe be relaxed? Lennart Poettering
2009-07-21 17:06 ` Denys Vlasenko
2009-07-21 17:17   ` Lennart Poettering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox