RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 876528 - Set-group-ID (SGID) bit not inherited on XFS file system with ACLs on directory
Summary: Set-group-ID (SGID) bit not inherited on XFS file system with ACLs on directory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel
Version: 6.3
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Carlos Maiolino
QA Contact: Eryu Guan
URL:
Whiteboard:
Depends On:
Blocks: 1019699
TreeView+ depends on / blocked
 
Reported: 2012-11-14 10:52 UTC by Aaron Tomlin
Modified: 2018-12-03 17:57 UTC (History)
12 users (show)

Fixed In Version: kernel-2.6.32-408.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1019699 (view as bug list)
Environment:
Last Closed: 2013-11-21 13:51:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 302663 0 None None None Never
Red Hat Product Errata RHSA-2013:1645 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 6 kernel update 2013-11-20 22:04:18 UTC

Description Aaron Tomlin 2012-11-14 10:52:40 UTC
Created attachment 644753 [details]
Systemtap script to capture the S_ISGID being removed in xfs_setattr()

Description of problem:

A child directory does not inherit the S_ISGID 
(group sticky bit) as expected, when the parent 
directory has ACL_TYPE_DEFAULT applied. S_ISGID 
is cleared in xfs_setattr() as illustrated below:

       /*   
        * Change file access modes.
        */
       if (mask & ATTR_MODE) {
               umode_t mode = iattr->ia_mode;
                if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
                       mode &= ~S_ISGID;
                ip->i_d.di_mode &= S_IFMT;
               ip->i_d.di_mode |= mode & ~S_IFMT;
                inode->i_mode &= S_IFMT;
               inode->i_mode |= mode & ~S_IFMT;
       }

This is also demonstrated below, via Systemtap (script attached):
       
	$ sudo mkdir hello
	$ sudo chown -R test:test hello/
	$ sudo chgrp fred hello/
	
 - Set the group sticky bit
	
	$ sudo chmod 2775 hello/
	$ cd hello/
	
 - Create a directory and notice that the 
   group sticky bit is applied for
   the "howareyou" directory as expected
   	
	$ mkdir howareyou
	
 - Apply an ACL and a default ACL on the "hello" directory 	
	
	$ setfacl -m u:test:rwx,d:u:test:rwx .
	
 - Create another directory and notice how the 
   group sticky bit is not applied

	$ mkdir howareyou4
	$ ls -lia
	total 16
	786752 drwxrwsr-x+ 6 test fred 73 Nov  4 21:44 .
	   128 drwxr-xr-x. 3 root root 18 Nov  4 13:49 ..
	   131 drwxrwsr-x. 2 test fred  6 Nov  3 13:50 howareyou
	   132 drwxrwxr-x+ 2 test fred  6 Nov  4 21:44 howareyou4
	
	...
	xfs_vn_mkdir:	dir->i_ino: 786752
	xfs_vn_mkdir:	dir->i_mode: 42775
	xfs_vn_mkdir:	dir->i_sb->s_flags: 0x40010000
	xfs_vn_mkdir:	mode: 777
	xfs_vn_mkdir:	dentry->d_parent->d_iname: "hello"
	xfs_vn_mkdir:	dentry->d_iname: "howareyou4"
	xfs_vn_mkdir:	dentry->d_inode: 0x0
	xfs_vn_mkdir:	dentry->d_count: 1
	xfs_vn_mkdir:	dentry->d_flags: 0x0
	xfs_set_mode:	inode->i_ino: 132
	xfs_set_mode:	inode->i_mode: 42777
	xfs_setattr:	S_ISGID bit cleared
	 0xffffffffa036fcc0 : xfs_setattr+0x4b0/0xab0 [xfs]
	 0xffffffffa031e552 : xfs_set_mode+0x52/0x60 [xfs]
	 0xffffffffa031ec7a : xfs_inherit_acl+0x9a/0xf0 [xfs]
	 0xffffffffa037b503 : xfs_vn_mknod+0xe3/0x1c0 [xfs]
	 0xffffffffa037b5f3 : xfs_vn_mkdir+0x13/0x20 [xfs]
	 0xffffffff81188617
	 0x0 (inexact)
	xfs_setattr:	inode->i_mode: 40775
	 0xffffffffa036fd18 : xfs_setattr+0x508/0xab0 [xfs]
	 0xffffffffa031e552 : xfs_set_mode+0x52/0x60 [xfs]
	 0xffffffffa031ec7a : xfs_inherit_acl+0x9a/0xf0 [xfs]
	 0xffffffffa037b503 : xfs_vn_mknod+0xe3/0x1c0 [xfs]
	 0xffffffffa037b5f3 : xfs_vn_mkdir+0x13/0x20 [xfs]
	 0xffffffff81188617
	 0x0 (inexact)
	Pass 5: run completed in 10usr/20sys/1241real ms.

Version-Release number of selected component (if applicable):

2.6.32-279.2.1.el6

How reproducible:

Always without fail

Expected results:

The group membership is preserved for all 
files and directories in that directory

Comment 8 Pablo Iranzo Gómez 2013-05-27 16:24:58 UTC
Hi,
Is there any ETA for a fix for this situation?

Customer is heavily using ACL's on XFS systems (for SAS), and has detected those problems with the behaviour of the sticky bit.

Thanks,
Pablo

Comment 9 Eric Sandeen 2013-05-31 00:40:04 UTC
We're looking at it now.  I sent an xfstests testcase upstream which demonstrates the behavior (generic/313).  TBH, we're trying to work out what the proper behavior really is...

Comment 10 Eric Sandeen 2013-05-31 19:32:48 UTC
Has the customer seen actual functional problems, or is the lack of the sticky bit more of a curiosity?

Comment 11 Pablo Iranzo Gómez 2013-06-01 08:14:14 UTC
(In reply to Eric Sandeen from comment #10)
> Has the customer seen actual functional problems, or is the lack of the
> sticky bit more of a curiosity?

Yes, we found the BZ after they observed this behaviour

Comment 14 Carlos Maiolino 2013-06-06 18:00:51 UTC
Hi, this is just a matter of naming, but the bugzilla subject is wrong.

The problem here is not in the Sticky bit (S_ISVTX or 01000), but in set-group-ID bit (S_ISGID or 02000).

I'm going to change the subject since it might cause confusion, misinterpretation and even false positive searches on BZ search engine (and other search engines).

TBH I've never seen anybody saying "group sticky bit" and this isn't the way the manpage describes it, so, it's better to keep it aligned with the manpage

Comment 15 Carlos Maiolino 2013-06-12 17:00:08 UTC
Hi,

the behaviour is caused while XFS checks for group permissions in the path xfs_setattr_nonsize()->inode_change_ok() and, xfs_setattr_mode(), where, in both cases, I_SGID is being revoked when the effective group id do not match with the group of the file/directory.

the problem here looks to be this check being done after we inherit parent's permissions, so, since the current effective group id do not match the default acl, SGID is revoked.

As said previously, this is an upstream bug indeed, so, it's also being discussed upstream, I'll update the bugzilla as soon as I have some good idea about how to fix it.

--Carlos

Comment 16 Carlos Maiolino 2013-06-18 19:22:08 UTC
Hi,

I sent a patch fixing the problem to the upstream xfs community, the patch is being reviewed and will be ported to our kernel soon.

--Carlos

Comment 18 RHEL Program Management 2013-07-17 18:47:22 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 19 Rafael Aquini 2013-08-07 15:46:27 UTC
Patch(es) available on kernel-2.6.32-408.el6

Comment 22 Eryu Guan 2013-09-05 09:11:22 UTC
xfstests generic/314 fails on kernel-2.6.32-358.el6
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 dhcp12-195 2.6.32-358.el6.x86_64
MKFS_OPTIONS  -- -f -b size=4096 /dev/sda6
MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/sda6 /mnt/testarea/scratch

generic/314      - output mismatch (see /var/lib/xfstests/results/generic/314.out.bad)
    --- tests/generic/314.out   2013-09-05 17:12:12.732601444 +0800
    +++ /var/lib/xfstests/results/generic/314.out.bad   2013-09-05 17:12:33.868601421 +0800
    @@ -1,3 +1,3 @@
     QA output created by 314
     drwxr-sr-x subdir
    -drwxrwsr-x+ subdir2
    +drwxrwxr-x+ subdir2
     ...
     (Run 'diff -u tests/generic/314.out /var/lib/xfstests/results/generic/314.out.bad' to see the entire diff)
Ran: generic/314
Failures: generic/314
Failed 1 of 1 tests

Verified on kernel-2.6.32-358.el6, generic/314 passes.
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 hp-dl388g8-03 2.6.32-414.el6.x86_64
MKFS_OPTIONS  -- -f -bsize=4096 /dev/mapper/testvg-testlv2
MOUNT_OPTIONS -- -o context=system_u:object_r:nfs_t:s0 /dev/mapper/testvg-testlv2 /mnt/testarea/scratch

generic/314 0s ... 0s
Ran: generic/314
Passed all 1 tests

Set to VERIFIED

Comment 25 errata-xmlrpc 2013-11-21 13:51:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-1645.html


Note You need to log in before you can comment on or make changes to this bug.