Jeff Layton | 20 Aug 2007 22:53
Picon
Favicon

[PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

This should fix all of the filesystems in the mainline kernels to handle
ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
just a matter of making sure that they call generic_attrkill early in
the setattr inode op.

Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
---
 arch/powerpc/platforms/cell/spufs/inode.c |    1 +
 fs/9p/vfs_inode.c                         |    1 +
 fs/affs/inode.c                           |    1 +
 fs/afs/inode.c                            |    3 +++
 fs/coda/inode.c                           |    1 +
 fs/configfs/inode.c                       |    4 +++-
 fs/ext2/inode.c                           |    1 +
 fs/ext3/inode.c                           |    5 ++++-
 fs/ext4/inode.c                           |    5 ++++-
 fs/fuse/dir.c                             |    2 ++
 fs/gfs2/ops_inode.c                       |    2 ++
 fs/hostfs/hostfs_kern.c                   |    2 ++
 fs/hpfs/inode.c                           |    1 +
 fs/hugetlbfs/inode.c                      |    5 ++++-
 fs/jffs2/fs.c                             |    1 +
 fs/jfs/acl.c                              |    2 ++
 fs/ocfs2/file.c                           |    2 ++
 fs/proc/base.c                            |    3 +++
 fs/proc/generic.c                         |    3 +++
 fs/proc/proc_sysctl.c                     |    3 +++
 fs/ramfs/file-nommu.c                     |    5 ++++-
 fs/reiserfs/inode.c                       |    6 +++++-
 fs/smbfs/inode.c                          |    2 ++
(Continue reading)

Dave Kleikamp | 20 Aug 2007 23:07
Picon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Mon, 2007-08-20 at 16:53 -0400, Jeff Layton wrote:
> This should fix all of the filesystems in the mainline kernels to handle
> ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> just a matter of making sure that they call generic_attrkill early in
> the setattr inode op.

Here's my ack for the jfs piece.

> 
> Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
Acked-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>

--

-- 
David Kleikamp
IBM Linux Technology Center

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
Timothy Shimmin | 21 Aug 2007 07:35
Picon
Favicon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

Jeff Layton wrote:
> This should fix all of the filesystems in the mainline kernels to handle
> ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> just a matter of making sure that they call generic_attrkill early in
> the setattr inode op.
> 
> Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
> ---
>  fs/xfs/linux-2.6/xfs_iops.c               |    5 ++++-
> --- a/fs/xfs/linux-2.6/xfs_iops.c
> +++ b/fs/xfs/linux-2.6/xfs_iops.c
>  <at>  <at>  -651,12 +651,15  <at>  <at>  xfs_vn_setattr(
>  	struct iattr	*attr)
>  {
>  	struct inode	*inode = dentry->d_inode;
> -	unsigned int	ia_valid = attr->ia_valid;
> +	unsigned int	ia_valid;
>  	bhv_vnode_t	*vp = vn_from_inode(inode);
>  	bhv_vattr_t	vattr = { 0 };
>  	int		flags = 0;
>  	int		error;
>  
> +	generic_attrkill(inode->i_mode, attr);
> +	ia_valid = attr->ia_valid;
> +
>  	if (ia_valid & ATTR_UID) {
>  		vattr.va_mask |= XFS_AT_UID;
>  		vattr.va_uid = attr->ia_uid;

Looks reasonable to me for XFS.
(Continue reading)

Jan Harkes | 21 Aug 2007 17:04
Picon
Favicon
Gravatar

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Mon, Aug 20, 2007 at 04:53:22PM -0400, Jeff Layton wrote:
> This should fix all of the filesystems in the mainline kernels to handle
> ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> just a matter of making sure that they call generic_attrkill early in
> the setattr inode op.
> 
> Signed-off-by: Jeff Layton <jlayton <at> redhat.com>

Coda part looks fine to me. Couldn't test it beyond 'it compiles and
doesn't oops', because our userspace client unconditionally strips
setuid/setgid bits anyways.

Acked-by: Jan Harkes <jaharkes <at> cs.cmu.edu>

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Timothy Shimmin | 21 Aug 2007 07:35
Picon
Favicon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

Jeff Layton wrote:
> This should fix all of the filesystems in the mainline kernels to handle
> ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> just a matter of making sure that they call generic_attrkill early in
> the setattr inode op.
> 
> Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
> ---
>  fs/xfs/linux-2.6/xfs_iops.c               |    5 ++++-
> --- a/fs/xfs/linux-2.6/xfs_iops.c
> +++ b/fs/xfs/linux-2.6/xfs_iops.c
>  <at>  <at>  -651,12 +651,15  <at>  <at>  xfs_vn_setattr(
>  	struct iattr	*attr)
>  {
>  	struct inode	*inode = dentry->d_inode;
> -	unsigned int	ia_valid = attr->ia_valid;
> +	unsigned int	ia_valid;
>  	bhv_vnode_t	*vp = vn_from_inode(inode);
>  	bhv_vattr_t	vattr = { 0 };
>  	int		flags = 0;
>  	int		error;
>  
> +	generic_attrkill(inode->i_mode, attr);
> +	ia_valid = attr->ia_valid;
> +
>  	if (ia_valid & ATTR_UID) {
>  		vattr.va_mask |= XFS_AT_UID;
>  		vattr.va_uid = attr->ia_uid;

Looks reasonable to me for XFS.
(Continue reading)

Jeff Layton | 21 Aug 2007 13:35
Picon
Favicon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Tue, 21 Aug 2007 15:35:08 +1000
Timothy Shimmin <tes <at> sgi.com> wrote:

> Jeff Layton wrote:
> > This should fix all of the filesystems in the mainline kernels to handle
> > ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> > just a matter of making sure that they call generic_attrkill early in
> > the setattr inode op.
> > 
> > Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
> > ---
> >  fs/xfs/linux-2.6/xfs_iops.c               |    5 ++++-
> > --- a/fs/xfs/linux-2.6/xfs_iops.c
> > +++ b/fs/xfs/linux-2.6/xfs_iops.c
> >  <at>  <at>  -651,12 +651,15  <at>  <at>  xfs_vn_setattr(
> >  	struct iattr	*attr)
> >  {
> >  	struct inode	*inode = dentry->d_inode;
> > -	unsigned int	ia_valid = attr->ia_valid;
> > +	unsigned int	ia_valid;
> >  	bhv_vnode_t	*vp = vn_from_inode(inode);
> >  	bhv_vattr_t	vattr = { 0 };
> >  	int		flags = 0;
> >  	int		error;
> >  
> > +	generic_attrkill(inode->i_mode, attr);
> > +	ia_valid = attr->ia_valid;
> > +
> >  	if (ia_valid & ATTR_UID) {
> >  		vattr.va_mask |= XFS_AT_UID;
(Continue reading)

Jeff Layton | 21 Aug 2007 13:35
Picon
Favicon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Tue, 21 Aug 2007 15:35:08 +1000
Timothy Shimmin <tes <at> sgi.com> wrote:

> Jeff Layton wrote:
> > This should fix all of the filesystems in the mainline kernels to handle
> > ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> > just a matter of making sure that they call generic_attrkill early in
> > the setattr inode op.
> > 
> > Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
> > ---
> >  fs/xfs/linux-2.6/xfs_iops.c               |    5 ++++-
> > --- a/fs/xfs/linux-2.6/xfs_iops.c
> > +++ b/fs/xfs/linux-2.6/xfs_iops.c
> >  <at>  <at>  -651,12 +651,15  <at>  <at>  xfs_vn_setattr(
> >  	struct iattr	*attr)
> >  {
> >  	struct inode	*inode = dentry->d_inode;
> > -	unsigned int	ia_valid = attr->ia_valid;
> > +	unsigned int	ia_valid;
> >  	bhv_vnode_t	*vp = vn_from_inode(inode);
> >  	bhv_vattr_t	vattr = { 0 };
> >  	int		flags = 0;
> >  	int		error;
> >  
> > +	generic_attrkill(inode->i_mode, attr);
> > +	ia_valid = attr->ia_valid;
> > +
> >  	if (ia_valid & ATTR_UID) {
> >  		vattr.va_mask |= XFS_AT_UID;
(Continue reading)

Josef Sipek | 21 Aug 2007 23:21
Picon
Favicon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Tue, Aug 21, 2007 at 07:35:51AM -0400, Jeff Layton wrote:
> On Tue, 21 Aug 2007 15:35:08 +1000
> Timothy Shimmin <tes <at> sgi.com> wrote:
> 
> > Jeff Layton wrote:
> > > This should fix all of the filesystems in the mainline kernels to handle
> > > ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> > > just a matter of making sure that they call generic_attrkill early in
> > > the setattr inode op.
> > > 
> > > Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
> > > ---
> > >  fs/xfs/linux-2.6/xfs_iops.c               |    5 ++++-
> > > --- a/fs/xfs/linux-2.6/xfs_iops.c
> > > +++ b/fs/xfs/linux-2.6/xfs_iops.c
> > >  <at>  <at>  -651,12 +651,15  <at>  <at>  xfs_vn_setattr(
> > >  	struct iattr	*attr)
> > >  {
> > >  	struct inode	*inode = dentry->d_inode;
> > > -	unsigned int	ia_valid = attr->ia_valid;
> > > +	unsigned int	ia_valid;
> > >  	bhv_vnode_t	*vp = vn_from_inode(inode);
> > >  	bhv_vattr_t	vattr = { 0 };
> > >  	int		flags = 0;
> > >  	int		error;
> > >  
> > > +	generic_attrkill(inode->i_mode, attr);
> > > +	ia_valid = attr->ia_valid;
> > > +
> > >  	if (ia_valid & ATTR_UID) {
(Continue reading)

Josef Sipek | 21 Aug 2007 23:21
Picon
Favicon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Tue, Aug 21, 2007 at 07:35:51AM -0400, Jeff Layton wrote:
> On Tue, 21 Aug 2007 15:35:08 +1000
> Timothy Shimmin <tes <at> sgi.com> wrote:
> 
> > Jeff Layton wrote:
> > > This should fix all of the filesystems in the mainline kernels to handle
> > > ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> > > just a matter of making sure that they call generic_attrkill early in
> > > the setattr inode op.
> > > 
> > > Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
> > > ---
> > >  fs/xfs/linux-2.6/xfs_iops.c               |    5 ++++-
> > > --- a/fs/xfs/linux-2.6/xfs_iops.c
> > > +++ b/fs/xfs/linux-2.6/xfs_iops.c
> > >  <at>  <at>  -651,12 +651,15  <at>  <at>  xfs_vn_setattr(
> > >  	struct iattr	*attr)
> > >  {
> > >  	struct inode	*inode = dentry->d_inode;
> > > -	unsigned int	ia_valid = attr->ia_valid;
> > > +	unsigned int	ia_valid;
> > >  	bhv_vnode_t	*vp = vn_from_inode(inode);
> > >  	bhv_vattr_t	vattr = { 0 };
> > >  	int		flags = 0;
> > >  	int		error;
> > >  
> > > +	generic_attrkill(inode->i_mode, attr);
> > > +	ia_valid = attr->ia_valid;
> > > +
> > >  	if (ia_valid & ATTR_UID) {
(Continue reading)

Jeff Layton | 22 Aug 2007 00:23
Picon
Favicon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Tue, 21 Aug 2007 17:21:28 -0400
Josef Sipek <jsipek <at> fsl.cs.sunysb.edu> wrote:

> On Tue, Aug 21, 2007 at 07:35:51AM -0400, Jeff Layton wrote:
> > On Tue, 21 Aug 2007 15:35:08 +1000
> > Timothy Shimmin <tes <at> sgi.com> wrote:
> > 
> > > Jeff Layton wrote:
> > > > This should fix all of the filesystems in the mainline kernels to handle
> > > > ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> > > > just a matter of making sure that they call generic_attrkill early in
> > > > the setattr inode op.
> > > > 
> > > > Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
> > > > ---
> > > >  fs/xfs/linux-2.6/xfs_iops.c               |    5 ++++-
> > > > --- a/fs/xfs/linux-2.6/xfs_iops.c
> > > > +++ b/fs/xfs/linux-2.6/xfs_iops.c
> > > >  <at>  <at>  -651,12 +651,15  <at>  <at>  xfs_vn_setattr(
> > > >  	struct iattr	*attr)
> > > >  {
> > > >  	struct inode	*inode = dentry->d_inode;
> > > > -	unsigned int	ia_valid = attr->ia_valid;
> > > > +	unsigned int	ia_valid;
> > > >  	bhv_vnode_t	*vp = vn_from_inode(inode);
> > > >  	bhv_vattr_t	vattr = { 0 };
> > > >  	int		flags = 0;
> > > >  	int		error;
> > > >  
> > > > +	generic_attrkill(inode->i_mode, attr);
(Continue reading)

Jeff Layton | 22 Aug 2007 00:23
Picon
Favicon

Re: [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Tue, 21 Aug 2007 17:21:28 -0400
Josef Sipek <jsipek <at> fsl.cs.sunysb.edu> wrote:

> On Tue, Aug 21, 2007 at 07:35:51AM -0400, Jeff Layton wrote:
> > On Tue, 21 Aug 2007 15:35:08 +1000
> > Timothy Shimmin <tes <at> sgi.com> wrote:
> > 
> > > Jeff Layton wrote:
> > > > This should fix all of the filesystems in the mainline kernels to handle
> > > > ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> > > > just a matter of making sure that they call generic_attrkill early in
> > > > the setattr inode op.
> > > > 
> > > > Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
> > > > ---
> > > >  fs/xfs/linux-2.6/xfs_iops.c               |    5 ++++-
> > > > --- a/fs/xfs/linux-2.6/xfs_iops.c
> > > > +++ b/fs/xfs/linux-2.6/xfs_iops.c
> > > >  <at>  <at>  -651,12 +651,15  <at>  <at>  xfs_vn_setattr(
> > > >  	struct iattr	*attr)
> > > >  {
> > > >  	struct inode	*inode = dentry->d_inode;
> > > > -	unsigned int	ia_valid = attr->ia_valid;
> > > > +	unsigned int	ia_valid;
> > > >  	bhv_vnode_t	*vp = vn_from_inode(inode);
> > > >  	bhv_vattr_t	vattr = { 0 };
> > > >  	int		flags = 0;
> > > >  	int		error;
> > > >  
> > > > +	generic_attrkill(inode->i_mode, attr);
(Continue reading)

Dave Kleikamp | 20 Aug 2007 23:07
Picon

Re: [Jfs-discussion] [PATCH 2/4] Fix mainline filesystems to handle ATTR_KILL_ bits correctly

On Mon, 2007-08-20 at 16:53 -0400, Jeff Layton wrote:
> This should fix all of the filesystems in the mainline kernels to handle
> ATTR_KILL_SUID and ATTR_KILL_SGID correctly. For most of them, this is
> just a matter of making sure that they call generic_attrkill early in
> the setattr inode op.

Here's my ack for the jfs piece.

> 
> Signed-off-by: Jeff Layton <jlayton <at> redhat.com>
Acked-by: Dave Kleikamp <shaggy <at> linux.vnet.ibm.com>

--

-- 
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane