generic/35[67]: update selinux context for mkswap
PATCH 1/1 generic/35[67]: update selinux context for mkswap
With selinux enabled & the default selinux context in fstests, mkswap is denied, generic/35[67] fail as:
+mkswap: unable to relabel /mnt/testarea/scratch/test-357/file1 to system_u:object_r:swapfile_t:s0: Operation not supported
So mount SCRATCH_DEV with swapfile selinux context if selinux is enabled (SELINUX_MOUNT_OPTIONS not empty).
--- tests/generic/356 | 4 ++++ tests/generic/357 | 4 ++++ 2 files changed, 8 insertions(+)
tests/generic/356 +4 -0
@@ -49,6 +49,10 @@ _require_cp_reflink echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 +# the default selinux context won't allow mkswap +if [ "$SELINUX_MOUNT_OPTIONS" != "" ]; then + export SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:swapfile_t:s0" +fi _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq
tests/generic/357 +4 -0
@@ -49,6 +49,10 @@ _require_cp_reflink echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 +# the default selinux context won't allow mkswap +if [ "$SELINUX_MOUNT_OPTIONS" != "" ]; then + export SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:swapfile_t:s0" +fi _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seq
Signature · 1 line
2.9.3
Quoted 34 lines · Eryu Guan
With selinux enabled & the default selinux context in fstests, mkswap is denied, generic/35[67] fail as:
+mkswap: unable to relabel
/mnt/testarea/scratch/test-357/file1to system_u:object_r:swapfile_t:s0: Operation not supportedSo mount
SCRATCH_DEVwith swapfile selinux context if selinux is enabled (SELINUX_MOUNT_OPTIONSnot empty).Signed-off-by Eryu Guan <[email protected]>--- tests/generic/356 | 4 ++++ tests/generic/357 | 4 ++++ 2 files changed, 8 insertions(+)tests/generic/356 +4
-0@@ -49,6 +49,10 @@ _require_cp_reflink echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 +# the default selinux context won't allow mkswap +if [ "$SELINUX_MOUNT_OPTIONS" != "" ]; then + export SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:swapfile_t:s0" +fi _scratch_mount >> $seqres.full 2>&1 testdir=$SCRATCH_MNT/test-$seqtests/generic/357 +0
-0
tests/generic/357 _require_cp_reflink · line 55
Quoted 7 lines
tests/generic/357 +4
-0@@ -49,6 +49,10 @@ _require_cp_reflink echo "Format and mount" _scratch_mkfs > $seqres.full 2>&1 +# the default selinux context won't allow mkswap +if [ "$SELINUX_MOUNT_OPTIONS" != "" ]; then + export SELINUX_MOUNT_OPTIONS="-o context=system_u:object_r:swapfile_t:s0" +fi
Can we put this inside the proprosed _require_scratch_swap() function or - better - just add the swapfile capability to the default SELINUX_MOUNT_OPTIONS parameters that we set?
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]