xfs
[Top] [All Lists]

Re: [PATCH] xfs: fix sgid inheritance for subdirectories inheriting defa

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH] xfs: fix sgid inheritance for subdirectories inheriting default acls [V2]
From: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
Date: Fri, 21 Jun 2013 14:48:05 -0300
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130619233951.GL29338@dastard>
References: <1371569536-5779-1-git-send-email-cmaiolino@xxxxxxxxxx> <20130618224351.GB29338@dastard> <20130619132921.GA5200@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20130619233951.GL29338@dastard>
User-agent: Mutt/1.5.20 (2009-12-10)
Thanks for the Review Dave, Patch V3 sent to ML

cheers
> On Wed, Jun 19, 2013 at 10:29:22AM -0300, Carlos Maiolino wrote:
> > Hi Dave,
> > 
> > > > @@ -594,9 +594,10 @@ xfs_setattr_nonsize(
> > > >                  * The set-user-ID and set-group-ID bits of a file will 
> > > > be
> > > >                  * cleared upon successful return from chown()
> > > >                  */
> > > > -               if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) &&
> > > > -                   !capable(CAP_FSETID))
> > > > -                       ip->i_d.di_mode &= ~(S_ISUID|S_ISGID);
> > > > +               if (!S_ISDIR(inode->i_mode))
> > > > +                       if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) &&
> > > > +                           !capable(CAP_FSETID))
> > > > +                               ip->i_d.di_mode &= ~(S_ISUID|S_ISGID);
> > > 
> > > I'm not sure I understand why this is part of this patch - the ACL
> > > path does not enter this code branch (ATTR_UID/GID) so it doesn't
> > > affect ACL inheritence. So this is some other behavioural change?
> > > 
> > My apologies to have not commented it.
> > 
> > During my code surfing to understand the problem, and what places we revoked
> > sgid, I found this one, and, based on chmod specifications, we should keep 
> > sgid
> > on the directory while chmoding it, unless the user explicitly ask for sgid
> > removal, otherwise, if chmoding a file, we remove sgid if this isn't 
> > specified
> > in the new mode. So, I've added a check here to ensure the inode isn't a dir
> > before remove the sgid bit.
> 

-- 
Carlos

<Prev in Thread] Current Thread [Next in Thread>