Check that attr mode is valid before using it when determining if to
clear SGID and SUID bits in ll_setattr.
Add regression test.
Lustre-commit:
1504473051df3d20e824f1064ee134501f3856e8
Lustre-change: http://review.whamcloud.com/10153
Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I3c8382d6f0899ce9190ccb2993af4c508942b316
Reviewed-on: http://review.whamcloud.com/10405
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
!(attr->ia_mode & S_ISGID))))
attr->ia_valid |= ATTR_FORCE;
- if ((mode & S_ISUID) &&
+ if ((attr->ia_valid & ATTR_MODE) &&
+ (mode & S_ISUID) &&
!(attr->ia_mode & S_ISUID) &&
!(attr->ia_valid & ATTR_KILL_SUID))
attr->ia_valid |= ATTR_KILL_SUID;
- if (((mode & (S_ISGID|S_IXGRP)) == (S_ISGID|S_IXGRP)) &&
+ if ((attr->ia_valid & ATTR_MODE) &&
+ ((mode & (S_ISGID|S_IXGRP)) == (S_ISGID|S_IXGRP)) &&
!(attr->ia_mode & S_ISGID) &&
!(attr->ia_valid & ATTR_KILL_SGID))
attr->ia_valid |= ATTR_KILL_SGID;
nobase_noinst_SCRIPTS += posix/posix.cfg
nobase_noinst_DATA = acl/cp.test acl/getfacl-noacl.test acl/inheritance.test
nobase_noinst_DATA += acl/misc.test acl/permissions.test acl/setfacl.test
+nobase_noinst_DATA += acl/974.test acl/974_remote.test
+nobase_noinst_DATA += acl/2561.test acl/4924.test
nobase_noinst_DATA += rmtacl/misc.test rmtacl/permissions.test
nobase_noinst_DATA += rmtacl/setfacl.test rmtacl/cp.test
nobase_noinst_DATA += rmtacl/getfacl-noacl.test rmtacl/inheritance.test
--- /dev/null
+LU-4924 - chmod g+s, touch should not clear sgid bit
+
+ $ mkdir 4924
+ $ cd 4924
+ $ touch f
+ $ chmod u=rwx,g=rwxs f
+ $ ls -l f | awk -- '{ print $1, $3, $4 }'
+ > -rwxrwsr-- root root
+ $ touch f
+ $ ls -l f | awk -- '{ print $1, $3, $4 }'
+ > -rwxrwsr-- root root
+ $ cd ..
+ $ rm -rf 4924
echo "LU-2561 newly created file is same size as directory..."
run_acl_subtest 2561 || error "LU-2561 test failed"
+ run_acl_subtest 4924 || error "LU-4924 test failed"
+
cd $SAVE_PWD
umask $SAVE_UMASK