From: Steven Whitehouse <swhiteho@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
chris.mason@oracle.com, josef@redhat.com, agruen@linbit.com,
"Serge E. Hallyn" <serue@us.ibm.com>
Subject: Re: [PATCH 1/4] Cache xattr security drop check for write v2
Date: Tue, 31 May 2011 14:51:36 +0100 [thread overview]
Message-ID: <1306849896.2816.22.camel@menhir> (raw)
In-Reply-To: <1306596354-18453-1-git-send-email-andi@firstfloor.org>
Hi,
On Sat, 2011-05-28 at 08:25 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> Some recent benchmarking on btrfs showed that a major scaling bottleneck
> on large systems on btrfs is currently the xattr lookup on every write.
>
> Why xattr lookup on every write I hear you ask?
>
> write wants to drop suid and security related xattrs that could set o
> capabilities for executables. To do that it currently looks up
> security.capability on EVERY write (even for non executables) to decide
> whether to drop it or not.
>
It sounds like a good idea, but cluster filesystems will need to clear
the flag when they update their in-core inodes. Without that we could
have:
Node A looks up inode and sets S_NOSEC since its not suid
Node B does chmod +s on the inode
Node A now has S_NOSEC set, but inode is suid, so writes don't clear
suid
For GFS2 it should simply be a case of adjusting gfs2_set_inode_flags()
to update S_NOSEC appropriately, something like this (untested):
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index a9f5cbe..3d856e4 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -174,7 +174,9 @@ void gfs2_set_inode_flags(struct inode *inode)
struct gfs2_inode *ip = GFS2_I(inode);
unsigned int flags = inode->i_flags;
- flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
+ flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_NOSEC);
+ if (!is_sxid(inode->i_mode))
+ flags |= S_NOSEC;
if (ip->i_diskflags & GFS2_DIF_IMMUTABLE)
flags |= S_IMMUTABLE;
if (ip->i_diskflags & GFS2_DIF_APPENDONLY)
Note that this also serves the dual purpose of setting the flag for
newly created inodes as well, as per the patches for the other
filesystems,
Steve.
next prev parent reply other threads:[~2011-05-31 13:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-28 15:25 [PATCH 1/4] Cache xattr security drop check for write v2 Andi Kleen
2011-05-28 15:25 ` [PATCH 2/4] EXT4: Set NOSEC flag early when there are no xattrs v2 Andi Kleen
2011-05-28 15:25 ` [PATCH 3/4] BTRFS: Set NOSEC early for btrfs v2 Andi Kleen
2011-05-28 15:25 ` [PATCH 4/4] XFS: Set NOSEC flag early when inode has no xattrs. v2 Andi Kleen
2011-05-31 13:51 ` Steven Whitehouse [this message]
2011-05-31 18:06 ` [PATCH 1/4] Cache xattr security drop check for write v2 Andi Kleen
2011-05-31 18:42 ` Steven Whitehouse
2011-05-31 20:07 ` Al Viro
2011-05-31 20:18 ` Andi Kleen
2011-05-31 20:21 ` Al Viro
2011-06-18 6:58 ` Marco Stornelli
2011-06-18 18:04 ` Andi Kleen
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=1306849896.2816.22.camel@menhir \
--to=swhiteho@redhat.com \
--cc=agruen@linbit.com \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=chris.mason@oracle.com \
--cc=josef@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=serue@us.ibm.com \
--cc=viro@zeniv.linux.org.uk \
/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