From: Andreas Gruenbacher <agruen@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: acl-devel@bestbits.at,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [FIX] Long-standing xattr sharing bug
Date: Sat, 05 Feb 2005 19:03:23 +0100 [thread overview]
Message-ID: <1107626603.27797.64.camel@winden.suse.de> (raw)
When looking for identical xattr blocks to share, we were not comparing
the name_index fields. This could lead to false sharing when two xattr
blocks ended up with identical attribute names and values, and the only
difference was in name_index. Specifically this could trigger with
default acls. Because acls are cached, the bug was hidden until the
next reload of the affected inode.
$ mkdir -m 700 a b
$ setfacl -m u:bin:rwx a
< acl of a goes in the mbcache
$ setfacl -dm u:bin:rwx b
< acl of b differs only in name_index, so a's acl is reused
$ getfacl b
< shows the result from the inode cache
< empty inode cache (remount, etc.)
$ getfacl b
< shows an access acl instead of a default acl.
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Index: linux-2.6.11-rc3/fs/ext2/xattr.c
===================================================================
--- linux-2.6.11-rc3.orig/fs/ext2/xattr.c
+++ linux-2.6.11-rc3/fs/ext2/xattr.c
@@ -881,6 +881,7 @@ ext2_xattr_cmp(struct ext2_xattr_header
if (IS_LAST_ENTRY(entry2))
return 1;
if (entry1->e_hash != entry2->e_hash ||
+ entry1->e_name_index != entry2->e_name_index ||
entry1->e_name_len != entry2->e_name_len ||
entry1->e_value_size != entry2->e_value_size ||
memcmp(entry1->e_name, entry2->e_name, entry1->e_name_len))
Index: linux-2.6.11-rc3/fs/ext3/xattr.c
===================================================================
--- linux-2.6.11-rc3.orig/fs/ext3/xattr.c
+++ linux-2.6.11-rc3/fs/ext3/xattr.c
@@ -1162,6 +1162,7 @@ ext3_xattr_cmp(struct ext3_xattr_header
if (IS_LAST_ENTRY(entry2))
return 1;
if (entry1->e_hash != entry2->e_hash ||
+ entry1->e_name_index != entry2->e_name_index ||
entry1->e_name_len != entry2->e_name_len ||
entry1->e_value_size != entry2->e_value_size ||
memcmp(entry1->e_name, entry2->e_name, entry1->e_name_len))
Regards,
--
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX GMBH
reply other threads:[~2005-02-05 18:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1107626603.27797.64.camel@winden.suse.de \
--to=agruen@suse.de \
--cc=acl-devel@bestbits.at \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome