From: Glenn Fowler <gsf@research.att.com>
To: davem@redhat.com, gsf@research.att.com
Cc: dgk@research.att.com, linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: Re: kernel bug in socketpair()
Date: Wed, 23 Jul 2003 13:24:36 -0400 (EDT) [thread overview]
Message-ID: <200307231724.NAA90957@raptor.research.att.com> (raw)
In-Reply-To: 20030723100043.18d5b025.davem@redhat.com
On Wed, 23 Jul 2003 10:00:43 -0700 David S. Miller wrote:
> On Wed, 23 Jul 2003 12:56:12 -0400 (EDT)
> Glenn Fowler <gsf@research.att.com> wrote:
> > the problem is that linux took an implementation shortcut by symlinking
> > /dev/fd/N -> /proc/self/fd/N
> > and by the time the kernel sees /proc/self/fd/N the "self"-ness is apparently
> > lost, and it is forced to do the security checks
> None of this is true. If you open /proc/self/fd/N directly the problem
> is still there.
you missed the point that the original open() call is on /dev/fd/N,
not /proc/PID/fd/N; /proc/PID/fd/N only comes into play because the
linux implementation foists it on the user
> > if the /proc fd open code has access to the original /proc/PID/fd/N path
> > then it can do dup(atoi(N)) when the PID is the current process without
> > affecting security
> If we're talking about the current process, there is no use in using
> /proc/*/fd/N to open a file descriptor in the first place, you can
> simply call open(N,...)
no, in the notation above N is the fd number "so you could simply call dup(N)"
here is one reason why /dev/fd/N is useful:
/dev/fd/N is the underlying mechanism for implementing the bash and ksh
cmd-1 <(cmd-2 ...) ... <(cmd-n ...)
each <(cmd-i ...) is converted to a pipe() with the write side getting the
output of cmd-i (and marked close on exec) and the read side *not* marked
close on exec; cmd-1 is then executed as
cmd-1 /dev/fd/PIPE-READ-2 ... /dev/fd/PIPE-READ-n
where PIPE-READ-i is the fd number of the read side of the pipe for cmd-i
next prev parent reply other threads:[~2003-07-23 17:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-23 14:28 Re: kernel bug in socketpair() David Korn
2003-07-23 14:46 ` David S. Miller
2003-07-23 16:56 ` Glenn Fowler
2003-07-23 17:00 ` David S. Miller
2003-07-23 17:24 ` Glenn Fowler [this message]
2003-07-23 17:31 ` David S. Miller
2003-07-23 18:14 ` Glenn Fowler
2003-07-23 18:23 ` David S. Miller
2003-07-23 18:54 ` Glenn Fowler
2003-07-23 19:04 ` David S. Miller
2003-07-23 19:11 ` Glenn Fowler
2003-07-23 19:14 ` David S. Miller
2003-07-23 19:29 ` Glenn Fowler
2003-07-23 19:56 ` David S. Miller
2003-07-23 22:24 ` jw schultz
2003-07-23 19:08 ` Alan Cox
2003-07-23 19:41 ` Andreas Jellinghaus
2003-07-23 17:50 ` Alan Cox
2003-07-23 23:27 ` Bill Rugolsky Jr.
-- strict thread matches above, loose matches on Subject: below --
2003-07-23 13:32 David Korn
2003-07-23 14:04 ` David S. Miller
2003-07-23 14:20 ` Alan Cox
2003-07-23 15:36 ` David S. Miller
2003-07-23 16:13 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200307231724.NAA90957@raptor.research.att.com \
--to=gsf@research.att.com \
--cc=davem@redhat.com \
--cc=dgk@research.att.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).