linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Ondrej Palkovsky <ondrap@penguin.cz>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: setfsuid() and access() syscall
Date: Tue, 4 Aug 2009 15:29:12 -0600	[thread overview]
Message-ID: <20090804212912.GK3711@parisc-linux.org> (raw)
In-Reply-To: <4A78A047.8040800@penguin.cz>

On Tue, Aug 04, 2009 at 10:55:35PM +0200, Ondrej Palkovsky wrote:
> /*
> * access() needs to use the real uid/gid, not the effective uid/gid.
> * We do this by temporarily clearing all FS-related capabilities and
> * switching the fsuid/fsgid around to the real ones.
> */
>
> The resulting behaviour (2.6.18, 2.6.28, source code for 2.6.30 seems to  
> be the same) seems to be that access() is dependent on uid, not fsuid -  
> this seems to me to be a bug, which unfortunately somewhat inhibits  
> multithreaded file servers that want to use access() e.g. for ACL  
> checks. Is there some reason why it is implemented the way it is as it  
> looks like an intention?

Unfortunately, POSIX specifies that we have to do it that way:

    The access() function shall check the file named by the pathname
    pointed to by the path argument for accessibility according to the
    bit pattern contained in amode, using the real user ID in place of
    the effective user ID and the real group ID in place of the effective
    group ID.

(http://www.opengroup.org/onlinepubs/000095399/functions/access.html)

Why does this fileserver want to use access()?  WHy not just open the
file and report the error if one happens?

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  reply	other threads:[~2009-08-04 21:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-04 20:55 setfsuid() and access() syscall Ondrej Palkovsky
2009-08-04 21:29 ` Matthew Wilcox [this message]
2009-08-05  7:57   ` Ondrej Palkovsky
2009-08-04 21:53 ` Serge E. Hallyn

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=20090804212912.GK3711@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ondrap@penguin.cz \
    /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).