linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* remove_suid bangs on xattrs
@ 2010-08-16 19:38 Chris Mason
  2010-08-16 19:44 ` Chris Mason
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Mason @ 2010-08-16 19:38 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: serue

Hi everyone,

I'm looking into a 2.6.35 btrfs performance regression, and perf tells
me that I'm spending a lot of time hammering on xattrs inside
remove_suid.  This is pretty surprising because I'm running as root, and
my files are not suid.  Looking back to this commit:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b53767719b6cd8789392ea3e7e2eb7b8906898f0

We've changed remove_suid's semantics from

if (file_is_suid)
    try to remove it

To something that always checks to see if we have removal permissions.

Was this intentional?  It didn't cause my 2.6.35 regression (that's all
my fault) but it does look wrong to me:

diff --git a/mm/filemap.c b/mm/filemap.c
index 4fb1546..79f24a9 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1627,12 +1627,18 @@ int __remove_suid(struct dentry *dentry, int kill)
 
 int remove_suid(struct dentry *dentry)
 {
-       int kill = should_remove_suid(dentry);
+       int killsuid = should_remove_suid(dentry);
+       int killpriv = security_inode_need_killpriv(dentry);
+       int error = 0;
 
-       if (unlikely(kill))
-               return __remove_suid(dentry, kill);
+       if (killpriv < 0)
+               return killpriv;
+       if (killpriv)
+               error = security_inode_killpriv(dentry);
+       if (!error && killsuid)
+               error = __remove_suid(dentry, killsuid);
 
-       return 0;
+       return error;
 }
 EXPORT_SYMBOL(remove_suid);

-chris


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-09-02 21:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-16 19:38 remove_suid bangs on xattrs Chris Mason
2010-08-16 19:44 ` Chris Mason
2010-08-18  2:41   ` Serge E. Hallyn
2010-08-20  5:31     ` Andrew G. Morgan
2010-08-20 12:25       ` Serge E. Hallyn
     [not found]       ` <5E83F6C3-2B1E-4FBF-960C-27364528813C@dilger.ca>
2010-09-02 16:02         ` Serge E. Hallyn
2010-09-02 21:01           ` Andreas Dilger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).