diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-06-03 18:24:58 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-06-03 18:24:58 -0400 |
commit | 9e1f1de02c2275d7172e18dc4e7c2065777611bf (patch) | |
tree | 15e9d202e64275cdbff6ed1d54804da5966d7d8d /mm/filemap.c | |
parent | 1fa7b6a29c61358cc2ca6f64cef4aa0e1a7ca74c (diff) | |
download | linux-3.10-9e1f1de02c2275d7172e18dc4e7c2065777611bf.tar.gz linux-3.10-9e1f1de02c2275d7172e18dc4e7c2065777611bf.tar.bz2 linux-3.10-9e1f1de02c2275d7172e18dc4e7c2065777611bf.zip |
more conservative S_NOSEC handling
Caching "we have already removed suid/caps" was overenthusiastic as merged.
On network filesystems we might have had suid/caps set on another client,
silently picked by this client on revalidate, all of that *without* clearing
the S_NOSEC flag.
AFAICS, the only reasonably sane way to deal with that is
* new superblock flag; unless set, S_NOSEC is not going to be set.
* local block filesystems set it in their ->mount() (more accurately,
mount_bdev() does, so does btrfs ->mount(), users of mount_bdev() other than
local block ones clear it)
* if any network filesystem (or a cluster one) wants to use S_NOSEC,
it'll need to set MS_NOSEC in sb->s_flags *AND* take care to clear S_NOSEC when
inode attribute changes are picked from other clients.
It's not an earth-shattering hole (anybody that can set suid on another client
will almost certainly be able to write to the file before doing that anyway),
but it's a bug that needs fixing.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index d7b10578a64..a8251a8d345 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2000,7 +2000,7 @@ int file_remove_suid(struct file *file) error = security_inode_killpriv(dentry); if (!error && killsuid) error = __remove_suid(dentry, killsuid); - if (!error) + if (!error && (inode->i_sb->s_flags & MS_NOSEC)) inode->i_flags |= S_NOSEC; return error; |