xfstests: fix selinux context handling
PATCH 1/1 xfstests: fix selinux context handling
With the new config stuff we lost the selinux options being set for systems with selinux turned on. We want the selinux context set all the time, wether we provide a MOUNT_OPTIONS value or not, so take this logic out of _mount_opts() and just put it in the body of common/config
--- common/config | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
common/config +8 -8
@@ -217,16 +217,16 @@ case "$HOSTOS" in ;; esac +# SELinux adds extra xattrs which can mess up our expected output. +# So, mount with a context, and they won't be created +# # nfs_t is a "liberal" context so we can use it. +if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then + SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0" + export SELINUX_MOUNT_OPTIONS +fi + _mount_opts() { - # SELinux adds extra xattrs which can mess up our expected output. - # So, mount with a context, and they won't be created - # # nfs_t is a "liberal" context so we can use it. - if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then - SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0" - export SELINUX_MOUNT_OPTIONS - fi - case $FSTYP in xfs) export MOUNT_OPTIONS=$XFS_MOUNT_OPTIONS
Signature · 6 lines
1.8.3.1 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Josef Bacik
With the new config stuff we lost the selinux options being set for systems with selinux turned on. We want the selinux context set all the time, wether we provide a
MOUNT_OPTIONSvalue or not, so take this logic out of_mount_opts()and just put it in the body of common/configSigned-off-by Josef Bacik <[email protected]>
This makes sense to me... untested, TBH, but I assume you did, so:
At some point it'd probably make sense to figure out which tests actually need this, and put it in a _use_selinux_context() or something, so that other tests still exercise under a normal selinux environment...
-Eric
Quoted 34 lines
--- common/config | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)common/config +8
-8@@ -217,16 +217,16 @@ case "$HOSTOS" in ;; esac +# SELinux adds extra xattrs which can mess up our expected output. +# So, mount with a context, and they won't be created +# # nfs_t is a "liberal" context so we can use it. +if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then + SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0" + export SELINUX_MOUNT_OPTIONS +fi + _mount_opts() { - # SELinux adds extra xattrs which can mess up our expected output. - # So, mount with a context, and they won't be created - # # nfs_t is a "liberal" context so we can use it. - if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then - SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:nfs_t:s0" - export SELINUX_MOUNT_OPTIONS - fi - case $FSTYP in xfs) export MOUNT_OPTIONS=$XFS_MOUNT_OPTIONS