code example (Re: euidaccess() as syscall)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Unneeded code path is there, but i'm not sure run overhead is
> measurable. Inflexibility and bug reports are, however.

Based on stripped, thus raceless-in-kernel
linux-2.6/fs/open.c:sys_faccessat()

Example expects non-error part to be likely, doesn't use "goto" in basic
stuff, isn't going to be used with unlikely_buggy(optimizing) GCC.

Comments?

# lang:C
asmlinkage long sys_feuidaccessat(int dfd, const char __user *filename, int mode)
{
	struct nameidata nd;
	int res;

	/* where's F_OK, X_OK, W_OK, R_OK? */
	if (!(mode & ~S_IRWXO)) {
		/* here */
		res = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
		if (!res) {
			res = vfs_permission(&nd, mode);
			/* SuS v2 requires we report a read only fs too */
			if (res || special_file(nd.dentry->d_inode->i_mode)
			    || !(mode & S_IWOTH))
			{} else	if (IS_RDONLY(nd.dentry->d_inode))
				res = -EROFS;
			path_release(&nd);
		}
		return res;
	}
	return -EINVAL;
}
#
-- 
sed 'sed && sh + olecom = love' << ''
-o--=O`C
 #oo'L O
<___=E M
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux