linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* xfstests #62 broken on ext4
@ 2011-08-13 14:38 Theodore Ts'o
  2011-08-13 15:57 ` Stefan Behrens
  2011-08-13 20:14 ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Theodore Ts'o @ 2011-08-13 14:38 UTC (permalink / raw)
  To: linux-ext4, xfs; +Cc: Stefan Behrens


Xfstests #62 was recently enabled by commit b2b36d0a4.

However, this test is failing for ext4 because ext4 doesn't support
extended attributes on anything other than regular files and
directories.  This is behavior is documented in the attr(5) man page:

   Extended user attributes
       Extended user attributes may be assigned to files and  directories  for
       storing arbitrary additional information such as the mime type, charac‐
       ter set or  encoding  of  a  file.  The  access  permissions  for  user
       attributes are defined by the file permission bits.

       The  file  permission  bits of regular files and directories are inter‐
       preted differently from the file permission bits of special  files  and
       symbolic  links.  For regular files and directories the file permission
       bits define access to the file's contents,  while  for  device  special
       files  they  define access to the device described by the special file.
       The file permissions of symbolic links are not used in  access  checks.
       These  differences would allow users to consume filesystem resources in
       a way not controllable by disk quotas for group or world writable  spe‐
       cial files and directories.

       For  this reason, extended user attributes are only allowed for regular
       files and directories,  and  access  to  extended  user  attributes  is
       restricted  to the owner and to users with appropriate capabilities for
       directories with the sticky bit set (see the chmod(1) manual  page  for
       an explanation of Sticky Directories).

... and it is enforced by the generic fs/xattr.c code in
xattr_permission():

	/*
	 * In the user.* namespace, only regular files and directories can have
	 * extended attributes. For sticky directories, only the owner and
	 * privileged users can write attributes.
	 */
	if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
		if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
			return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
		if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
		    (mask & MAY_WRITE) && !inode_owner_or_capable(inode))
			return -EPERM;
	}



It looks like XFS is not conformant to documented behaviour and the file
system generic code.   The question is how should we fix this?  I can
think of a couple of different options

(1) Back out commit b2b36d0a4 and make test #62 XFS-specific again.

(2) Option #1, above, and then also create another test for file systems
with the standard/generic Linux behavior

(3) Modify test #62 so that it can support both the XFS and Linux
generic behavior.

(4) Change the generic code to match what XFS does (despite the design
rationale mentioned in the attr(5) man page).

(5) Change XFS to match the generic behavior, and then change test #62.

What do people think?

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-19 14:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-13 14:38 xfstests #62 broken on ext4 Theodore Ts'o
2011-08-13 15:57 ` Stefan Behrens
2011-08-13 20:14 ` Christoph Hellwig
2011-08-14  0:44   ` Ted Ts'o
2011-08-14 16:09     ` Christoph Hellwig
2011-08-19 14:46   ` Eric Sandeen

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).