]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
btrfs/012: fix false alerts when SELinux is enabled
authorQu Wenruo <wqu@suse.com>
Fri, 18 Oct 2024 00:04:53 +0000 (10:34 +1030)
committerZorro Lang <zlang@kernel.org>
Thu, 24 Oct 2024 12:48:38 +0000 (20:48 +0800)
commit0d203737049ddafb9bbec4ad404234e8bb006748
tree70b3a47ca48c6a35dd65333bb28daf77b78cee2d
parentbd0d0179baf1f88b333c2240f4f181a59dc381e5
btrfs/012: fix false alerts when SELinux is enabled

[FALSE FAILURE]
If SELinux is enabled, the test btrfs/012 will fail due to metadata
mismatch:

FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 localhost 6.4.0-150600.23.25-default #1 SMP PREEMPT_DYNAMIC Tue Oct  1 10:54:01 UTC 2024 (ea7c56d)
MKFS_OPTIONS  -- /dev/loop1
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/loop1 /mnt/scratch

btrfs/012       - output mismatch (see /home/adam/xfstests-dev/results//btrfs/012.out.bad)
    --- tests/btrfs/012.out 2024-10-18 10:15:29.132894338 +1030
    +++ /home/adam/xfstests-dev/results//btrfs/012.out.bad 2024-10-18 10:25:51.834819708 +1030
    @@ -1,6 +1,1390 @@
     QA output created by 012
     Checking converted btrfs against the original one:
    -OK
    +metadata mismatch in /p0/d2/f4
    +metadata mismatch in /p0/d2/f5
    +metadata and data mismatch in /p0/d2/
    +metadata and data mismatch in /p0/
    ...

[CAUSE]
All the mismatch happens in the metadata, to be more especific, it's the
security xattrs.

Although btrfs-convert properly convert all xattrs including the
security ones, at mount time we will get new SELinux labels, causing the
mismatch between the converted and original fs.

[FIX]
Override SELINUX_MOUNT_OPTIONS so that we will not touch the security
xattrs, and that should fix the false alert.

Reported-by: Long An <lan@suse.com>
Link: https://bugzilla.suse.com/show_bug.cgi?id=1231524
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/012