[7750] in Athena Bugs

home help back first fref pref prev next nref lref last post

vax 7.2R: access()

daemon@ATHENA.MIT.EDU (Marc Horowitz)
Thu Jul 18 15:54:08 1991

To: bugs@ATHENA.MIT.EDU
Date: Thu, 18 Jul 91 15:54:10 EDT
From: Marc Horowitz <marc@ATHENA.MIT.EDU>

System name:		beeblebrox
Type and version:	CVAXSTAR 7.2R (2 update(s) to same version)
Display type:		SM

What were you trying to do?
	Determine if I could exec a file

What's wrong:
	I was root.  In sys/ufs/ufs_inode.c, function iaccess()

	/*
	 * If you're the super-user,
	 * you always get access.
	 */
	if (u.u_uid == 0)
		return (0);

	Well, that just ain't true.  Root can exec any file, but only
if one of the exec bits is set (any one).  I just did
access("/etc/srvtab", X_OK); and it returned 0.  Sorry, I can't exec
that file.  exec() actually returns EPERM.

What should have happened:
	As root, the exec bits should still be checked.

Please describe any relevant documentation references:
	access(2) sort of alludes to this case:

... a file may look executable, but execve will fail unless it is in
proper format.

	Well, IMHO, in this case, the attitude of iaccess() is a
little cavalier, since what I wanted to know was if any exec bits were
set.  You could consider mode 444 as not a "proper format", but I'm
not convinced.  My understanding was that since access only reads the
inode, it couldn't guarantee its response in certain cases.  But in
this case, the call could determine that the file was non-executeable
from just the mode information.

home help back first fref pref prev next nref lref last post