From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: realpath() and setfsuid programs
Date: Sat, 7 Feb 2015 11:04:57 -0500 [thread overview]
Message-ID: <20150207160457.GY23507@brightrain.aerifal.cx> (raw)
In-Reply-To: <20150207162829.3cdfa036@vostro>
On Sat, Feb 07, 2015 at 04:28:29PM +0200, Timo Teras wrote:
> > > Why is the check not simply an ownership check for the mount point?
> > > I suspect it has to do with the need to pass a pathname rather than
> > > fd to mount, which is subject to renaming/moving races, but the
> > > realpath call would be subject to the same and worse. Presumably
> > > the correct way to do this is to open a fd to the mountpoint then
> > > pass /proc/self/fd/%d to the mount function after checking
> > > ownership.
> >
> > Or of course just using chdir and checking ownership of ".".
>
> Agreed. In this case fuse seems to be the place needing fix. Dropping
> privileges just for realpath() does not sound like the right approach.
>
> Though, I'm wondering if the issue showing up in other places -- that
> is realpath() failing if fs uid is set to something that cannot
> read /proc/self/fd/...
realpath can fail for various reasons, like lacking permissions to a
path component, fd exhaustion or other resource issues, etc. so I
don't think it's a big deal for it to fail when /proc/self/fd/%d is
not accessible. It's not a robust operation to begin with.
Rich
prev parent reply other threads:[~2015-02-07 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-07 7:53 Timo Teras
2015-02-07 12:26 ` Rich Felker
2015-02-07 12:32 ` Rich Felker
2015-02-07 14:28 ` Timo Teras
2015-02-07 16:04 ` Rich Felker [this message]
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=20150207160457.GY23507@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).