From: Christoph Hellwig on
On Tue, Mar 02, 2010 at 07:01:05PM +1100, James Morris wrote:
> I noticed that there are differences in the behavior of listxattr(2) for
> xattrs in the trusted namespace.
>
> Some filesystems, such as ext[234], require CAP_SYS_ADMIN for this, i.e.
> trusted xattr names are hidden from unprivileged users.
>
> I audited the kernel for users of the trusted xattr namespace, and found
> the following filesystems not checking for CAP_SYS_ADMIN:
>
> - jffs2
> - ocfs2
> - btrfs
> - xfs
>
> I've created patches for jffs2 (tested) and ocfs2 (not tested) to add the
> check -- see following emails. btrfs and xfs have custom listxattr
> operations and will need a bit more work to fix.

I think the behaviour of the above filesystems is correct. There is no
requirement for privilegues to see the existence of these attributes.
We also don't hide entries that aren't readable from readdir output.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Christoph Hellwig on
On Tue, Mar 02, 2010 at 07:01:05PM +1100, James Morris wrote:
> I audited the kernel for users of the trusted xattr namespace, and found
> the following filesystems not checking for CAP_SYS_ADMIN:
>
> - jffs2
> - ocfs2
> - btrfs
> - xfs

Now that everyone felt the consensus is that we need the check I look
into adding it into XFS, but it seems like we already have that check
in xfs_xattr_put_listent:

/*
* Only show root namespace entries if we are actually allowed to
* see them.
*/
if ((flags & XFS_ATTR_ROOT) && !capable(CAP_SYS_ADMIN))
return 0;

Can you send me the testcases where XFs shows trusted attributes?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/