]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] Fix listxattr() for generic security attributes
authorDaniel Drake <dsd@gentoo.org>
Mon, 12 Dec 2005 08:37:08 +0000 (00:37 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 12 Dec 2005 16:57:42 +0000 (08:57 -0800)
commite84063eab256171243f4e3573403f8cbe15b7cdb
tree6498b7f6606027f3a52417431222b7a69c43391d
parent7d2c13f963d2254dbcf74a9ef88a716eec2f8d96
[PATCH] Fix listxattr() for generic security attributes

Commit 1995bda1687a42e4352707a4a9c90534ef46ad99 introduced a generic
fallback for security xattrs, but appears to include a subtle bug.

Gentoo users with kernels with selinux compiled in, and coreutils compiled
with acl support, noticed that they could not copy files on tmpfs using
'cp'.

cp (compiled with acl support) copies the file, lists the extended
attributes on the old file, copies them all to the new file, and then
exits.  However the listxattr() calls were failing with this odd behaviour:

llistxattr("a.out", (nil), 0)           = 17
llistxattr("a.out", 0x7fffff8c6cb0, 17) = -1 ERANGE (Numerical result out of
range)

I believe this is a simple problem in the logic used to check the buffer
sizes; if the user sends a buffer the exact size of the data, then its ok
:)

This change solves the problem.
More info can be found at http://bugs.gentoo.org/113138

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Acked-by: James Morris <jmorris@namei.org>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/xattr.c