]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
btrfs/314: fix the failure when SELinux is enabled
authorDaniel Vacek <neelx@suse.com>
Mon, 24 Feb 2025 11:10:14 +0000 (12:10 +0100)
committerZorro Lang <zlang@kernel.org>
Thu, 6 Mar 2025 10:12:36 +0000 (18:12 +0800)
commit203b0dca6e46903c9ecd6cfcef5079c45e5e8498
treecbe837a887526dea58bb6d3486229c5edd4e7fc6
parent8d273a3f296429680b9cc888f4c0e84cddaaa2d6
btrfs/314: fix the failure when SELinux is enabled

When SELinux is enabled this test fails unable to receive a file with
security label attribute:

    --- tests/btrfs/314.out
    +++ results//btrfs/314.out.bad
    @@ -17,5 +17,6 @@
     At subvol TEST_DIR/314/tempfsid_mnt/snap1
     Receive SCRATCH_MNT
     At subvol snap1
    +ERROR: lsetxattr foo security.selinux=unconfined_u:object_r:unlabeled_t:s0 failed: Operation not supported
     Send: 42d69d1a6d333a7ebdf64792a555e392  TEST_DIR/314/tempfsid_mnt/foo
    -Recv: 42d69d1a6d333a7ebdf64792a555e392  SCRATCH_MNT/snap1/foo
    +Recv: d41d8cd98f00b204e9800998ecf8427e  SCRATCH_MNT/snap1/foo
    ...

Setting the security label file attribute fails due to the default mount
option implied by fstests:

MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sdb /mnt/scratch

See commit 3839d299 ("xfstests: mount xfs with a context when selinux is on")

fstests by default mount test and scratch devices with forced SELinux
context to get rid of the additional file attributes when SELinux is
enabled. When a test mounts additional devices from the pool, it may need
to honor this option to keep on par. Otherwise failures may be expected.

Moreover this test is perfectly fine labeling the files so let's just
disable the forced context for this one.

Signed-off-by: Daniel Vacek <neelx@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/314