OpenCloudOS-Kernel/fs/fuse
Miklos Szeredi c01638f5d9 fuse: fix clearing suid, sgid for chown()
Basically, the pjdfstests set the ownership of a file to 06555, and then
chowns it (as root) to a new uid/gid. Prior to commit a09f99edde ("fuse:
fix killing s[ug]id in setattr"), fuse would send down a setattr with both
the uid/gid change and a new mode.  Now, it just sends down the uid/gid
change.

Technically this is NOTABUG, since POSIX doesn't _require_ that we clear
these bits for a privileged process, but Linux (wisely) has done that and I
think we don't want to change that behavior here.

This is caused by the use of should_remove_suid(), which will always return
0 when the process has CAP_FSETID.

In fact we really don't need to be calling should_remove_suid() at all,
since we've already been indicated that we should remove the suid, we just
don't want to use a (very) stale mode for that.

This patch should fix the above as well as simplify the logic.

Reported-by: Jeff Layton <jlayton@redhat.com> 
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: a09f99edde ("fuse: fix killing s[ug]id in setattr")
Cc: <stable@vger.kernel.org>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
2016-12-06 16:18:45 +01:00
..
Kconfig fuse: Add posix ACL support 2016-10-01 07:32:32 +02:00
Makefile fuse: Use generic xattr ops 2016-10-01 07:32:32 +02:00
acl.c fuse: Add posix ACL support 2016-10-01 07:32:32 +02:00
control.c fs: Replace CURRENT_TIME with current_time() for inode timestamps 2016-09-27 21:06:21 -04:00
cuse.c fuse: Add reference counting for fuse_io_priv 2016-03-14 15:02:51 +01:00
dev.c Merge branch 'work.splice_read' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-10-07 15:36:58 -07:00
dir.c fuse: fix clearing suid, sgid for chown() 2016-12-06 16:18:45 +01:00
file.c fuse: fix fuse_write_end() if zero bytes were copied 2016-11-15 12:34:21 +01:00
fuse_i.h fuse: fix root dentry initialization 2016-10-18 15:36:48 +02:00
inode.c fuse: fix root dentry initialization 2016-10-18 15:36:48 +02:00
xattr.c fuse: limit xattr returned size 2016-10-03 11:06:05 +02:00