From: Linus Torvalds <torvalds@osdl.org>
To: Jason Riedy <ejr@EECS.Berkeley.EDU>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Git 1.3.2 on Solaris
Date: Tue, 23 May 2006 11:24:43 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0605231110230.5623@g5.osdl.org> (raw)
In-Reply-To: <19270.1148407414@lotus.CS.Berkeley.EDU>
On Tue, 23 May 2006, Jason Riedy wrote:
>
> - Btw, even SuS says:
> [...]
> - New implementations are discouraged from returning X_OK unless at
> - least one execution permission bit is set."
>
> Now there is one possible, cross-OS problem that I
> haven't tested. You can chmod a-x and then use
> setfacl to grant one person execute access. I'm not
> sure if access works in that case, but that might
> possibly just say that current ACL systems are crap.
I absolutely agree. That is why the OS has a "access()" system call. It's
there to ask the OS whether the file is executable (or readable/writable).
Otherwise, we'd just do
static inline int executable(const char *path)
{
struct stat st;
return !stat(pathname, &st) &&
S_ISREG(st.st_mode) &&
(st.st_mode & 0111) != 0;
}
and be done with it. But exactly because the OS knows what "executable"
means, we ask it. We don't know about all the ACL's etc, the OS does.
(Similar issues are true for writability too - the file may be "writable"
in the sense that the write permission bits are on, but if the filesystem
is mounted read-only, it sure as hell ain't W_OK _anyway_).
> Hmm. Does access handle SELinux or the other systems?
Yup.
Modulo bugs, of course, but yes, access() on linux should check both
POSIX ACL's and SELinux security extensions. It uses exactly the same
code-paths that open()/execve() does: it uses the "vfs_permission()"
function which is also what execve() uses.
Now, I think access() actually misses a no-exec mount (it doesn't seem to
check MNT_NOEXEC for X_OK), and that looks like it might actually be a
real bug.
Linus
next prev parent reply other threads:[~2006-05-23 18:24 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-16 23:52 Git 1.3.2 on Solaris Stefan Pfetzing
2006-05-17 1:25 ` Jason Riedy
2006-05-17 2:20 ` Linus Torvalds
2006-05-17 3:26 ` Jason Riedy
2006-05-17 3:49 ` Linus Torvalds
2006-05-17 8:05 ` Stefan Pfetzing
2006-05-17 14:33 ` Linus Torvalds
2006-05-17 15:08 ` Stefan Pfetzing
2006-05-17 16:24 ` Linus Torvalds
2006-05-17 16:35 ` Jason Riedy
2006-05-23 3:20 ` Stefan Pfetzing
2006-05-23 4:51 ` Jason Riedy
2006-05-23 12:04 ` Stefan Pfetzing
2006-05-23 14:53 ` Linus Torvalds
2006-05-23 15:20 ` Edgar Toernig
2006-05-23 15:31 ` Linus Torvalds
2006-05-23 18:43 ` Edgar Toernig
2006-05-23 18:03 ` Jason Riedy
2006-05-23 18:24 ` Linus Torvalds [this message]
2006-05-23 18:48 ` Linus Torvalds
2006-05-26 3:30 ` Stefan Pfetzing
2006-05-17 5:15 ` Ryan Anderson
2006-05-17 8:22 ` Junio C Hamano
2006-05-17 9:03 ` Junio C Hamano
2006-05-17 9:54 ` [PATCH] builtin-grep: workaround for non GNU grep Junio C Hamano
2006-05-17 14:24 ` Linus Torvalds
2006-05-17 17:41 ` Junio C Hamano
2006-05-17 15:39 ` Bertrand Jacquin
2006-05-17 17:42 ` Junio C Hamano
2006-05-17 18:12 ` Linus Torvalds
2006-05-17 18:59 ` Junio C Hamano
2006-05-17 19:42 ` Linus Torvalds
2006-05-17 8:28 ` Git 1.3.2 on Solaris Junio C Hamano
2006-05-17 9:06 ` Stefan Pfetzing
2006-05-17 9:22 ` Junio C Hamano
2006-05-17 10:41 ` Stefan Pfetzing
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=Pine.LNX.4.64.0605231110230.5623@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=ejr@EECS.Berkeley.EDU \
--cc=git@vger.kernel.org \
/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).