Linux-Dash Archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: dash@vger.kernel.org, Christoph Egger <christoph@debian.org>,
	Petr Salinger <Petr.Salinger@seznam.cz>
Subject: Re: [PATCH v2] [BUILTIN] Fix "test -x" as root on FreeBSD 8
Date: Mon, 17 Nov 2014 22:49:46 +0800	[thread overview]
Message-ID: <20141117144946.GA1778@gondor.apana.org.au> (raw)
In-Reply-To: <20110927231906.GC19549@elie>

On Tue, Sep 27, 2011 at 06:19:06PM -0500, Jonathan Nieder wrote:
> POSIX.1-2008 §4.4 "File Access Permission" sayeth:
> 
> 	If execute permission is requested, access shall be granted
> 	if execute permission is granted to at least one user by the
> 	file permission bits or by an alternate access control
> 	mechanism; otherwise, access shall be denied.
> 
> For historical reasons, POSIX unfortunately also allows access() and
> faccessat() to return success for X_OK if the current process is
> privileged, even when the above condition is not fulfilled and actual
> execution would fail.  On the affected platforms, "test -x <path>" as
> root started returning true on nonexecutable files when dash switched
> from its own emulation to the true faccessat in v0.5.7~54
> (2010-04-02).
> 
> Work around this by checking the permissions bits when mode == X_OK
> and geteuid() == 0 on such platforms.
> 
> Unfortunately the behavior seems to vary from one kernel version to
> another, so we cannot just check the behavior at compile time and rely
> on that.  A survey of some affected kernels:
> 
>  - NetBSD's kernel moved to the sane semantics in 1997
>  - OpenBSD's kernel made the same change in version 4.4, three years
>    ago
>  - FreeBSD 9's kernel fixes this but hasn't been released yet
> 
> It seems safe to only apply the workaround on systems using the
> FreeBSD kernel for now, and to push for standardization on the
> expected access()/faccessat() semantics so we can drop the workaround
> altogether in a few years.
> 
> To try it on other platforms, use "./configure --enable-test-workaround".
> 
> Reported-by: Christoph Egger <christoph@debian.org>
> Analysis-by: Petr Salinger <Petr.Salinger@seznam.cz>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

This patch seems to have slipped through the cracks.  Nevertheless
it is now applied.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      reply	other threads:[~2014-11-17 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-26 21:16 [PATCH] [BUILTIN] Make "test -x" sane again when run as root Jonathan Nieder
2011-09-26 22:16 ` Jonathan Nieder
2011-09-27 13:45   ` Herbert Xu
2011-09-27 23:19     ` [PATCH v2] [BUILTIN] Fix "test -x" as root on FreeBSD 8 Jonathan Nieder
2014-11-17 14:49       ` Herbert Xu [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=20141117144946.GA1778@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=Petr.Salinger@seznam.cz \
    --cc=christoph@debian.org \
    --cc=dash@vger.kernel.org \
    --cc=jrnieder@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).