From: Daniel Drake <dsd@gentoo.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, sds@tycho.nsa.gov, jmorris@namei.org
Subject: [PATCH] Fix listxattr() for generic security attributes
Date: Thu, 08 Dec 2005 16:13:17 +0000 [thread overview]
Message-ID: <43985B9D.60506@gentoo.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 949 bytes --]
Commit f549d6c18c0e8e6cf1bf0e7a47acc1daf7e2cec1 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 patch solves the problem. Please apply for 2.6.15.
More info can be found at http://bugs.gentoo.org/113138
Signed-off-by: Daniel Drake <dsd@gentoo.org>
[-- Attachment #2: xattr-security-bounds-check.patch --]
[-- Type: text/x-patch, Size: 415 bytes --]
--- linux/fs/xattr.c.orig 2005-12-08 11:48:31.000000000 +0000
+++ linux/fs/xattr.c 2005-12-08 11:48:50.000000000 +0000
@@ -243,7 +243,7 @@ listxattr(struct dentry *d, char __user
error = d->d_inode->i_op->listxattr(d, klist, size);
} else {
error = security_inode_listsecurity(d->d_inode, klist, size);
- if (size && error >= size)
+ if (size && error > size)
error = -ERANGE;
}
if (error > 0) {
next reply other threads:[~2005-12-08 16:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-08 16:13 Daniel Drake [this message]
2005-12-08 16:29 ` [PATCH] Fix listxattr() for generic security attributes James Morris
2005-12-08 16:35 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43985B9D.60506@gentoo.org \
--to=dsd@gentoo.org \
--cc=akpm@osdl.org \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.