public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs mailing list <xfs@oss.sgi.com>
Subject: [PATCH] xfstests: mount with security context if SELinux is enabled
Date: Tue, 04 Nov 2008 10:17:22 -0600	[thread overview]
Message-ID: <49107592.3030800@sandeen.net> (raw)

When SELinux is enabled, it adds extra xattrs for security
attributes which can change the output of various tests, causing
them to fail.

If SELinux is enabled, mount with a liberal/permissive context
for the entire filesystem, so that SELinux xattrs don't get
created.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

Index: xfs-cmds/xfstests/common.rc
===================================================================
--- xfs-cmds.orig/xfstests/common.rc
+++ xfs-cmds/xfstests/common.rc
@@ -39,9 +39,18 @@ dd()
 
 _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 [ "$HOSTOS" == "Linux" ]; then
+	if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+		SELINUX_OPTIONS="-o context=system_u:object_r:nfs_t:s0"
+	fi
+    fi
+
     case $FSTYP in
     xfs)
-	export MOUNT_OPTIONS=$XFS_MOUNT_OPTIONS
+	export MOUNT_OPTIONS="$XFS_MOUNT_OPTIONS $SELINUX_OPTIONS"
 	;;
     udf)
 	export MOUNT_OPTIONS=$UDF_MOUNT_OPTIONS

             reply	other threads:[~2008-11-04 16:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04 16:17 Eric Sandeen [this message]
2008-11-05  4:32 ` [PATCH] xfstests: mount with security context if SELinux is enabled Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49107592.3030800@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox