• Carlos Maiolino's avatar
    xfs: fix sgid inheritance for subdirectories inheriting default acls [V3] · 42c49d7f
    Carlos Maiolino authored
    XFS removes sgid bits of subdirectories under a directory containing a default
    acl.
    
    When a default acl is set, it implies xfs to call xfs_setattr_nonsize() in its
    code path. Such function is shared among mkdir and chmod system calls, and
    does some checks unneeded by mkdir (calling inode_change_ok()). Such checks
    remove sgid bit from the inode after it has been granted.
    
    With this patch, we extend the meaning of XFS_ATTR_NOACL flag to avoid these
    checks when acls are being inherited (thanks hch).
    
    Also, xfs_setattr_mode, doesn't need to re-check for group id and capabilities
    permissions, this only implies in another try to remove sgid bit from the
    directories. Such check is already done either on inode_change_ok() or
    xfs_setattr_nonsize().
    
    Changelog:
    
    V2: Extends the meaning of XFS_ATTR_NOACL instead of wrap the tests into another
        function
    
    V3: Remove S_ISDIR check in xfs_setattr_nonsize() from the patch
    Signed-off-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
    Reviewed-by: default avatarBen Myers <bpm@sgi.com>
    Signed-off-by: default avatarBen Myers <bpm@sgi.com>
    42c49d7f
xfs_iops.c 30.1 KB