mbox series

[0/1] selinux-testsuite: Add btrfs support for filesystem tests

Message ID 20201013145456.77253-1-richard_c_haines@btinternet.com (mailing list archive)
Headers show
Series selinux-testsuite: Add btrfs support for filesystem tests | expand

Message

Richard Haines Oct. 13, 2020, 2:54 p.m. UTC
This patch allows BTRFS filesystems to be tested.

The tests/filesystem all pass using './test -f btrfs' on Fedora 32.
The tests/fs_filesystem fail 42 of 57 using './test -f btrfs' on Fedora 32.

As Fedora 33/Rawhide now defaults to using btrfs, running 'make test' will
fail 42 of 57 fs_filesystem tests (tested on Rawhide).

These fs_filesystem failures are caused by a bug when using the fsmount(2)
type calls that was reported in [1].

Note btrfs requires a much larger image size (min 115 MiB), and therefore
takes more than 2x longer to run tests than ext4.

[1] https://lore.kernel.org/selinux/c02674c970fa292610402aa866c4068772d9ad4e.camel@btinternet.com/

Richard Haines (1):
  selinux-testsuite: Add BTRFS support for filesystem tests

 tests/filesystem/Filesystem.pm | 10 +++++++++-
 tests/filesystem/test          |  6 ++++++
 tests/fs_filesystem/test       |  6 ++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

Comments

Ondrej Mosnacek Oct. 30, 2020, 9:55 p.m. UTC | #1
On Tue, Oct 13, 2020 at 4:55 PM Richard Haines
<richard_c_haines@btinternet.com> wrote:
>
> This patch allows BTRFS filesystems to be tested.
>
> The tests/filesystem all pass using './test -f btrfs' on Fedora 32.

For me, also these tests are failing (41 of 58):

Test Summary Report
-------------------
filesystem/btrfs/test     (Wstat: 10496 Tests: 58 Failed: 41)
  Failed tests:  3-4, 10, 13-15, 17-25, 27-28, 30-37, 39-45
                47-55
  Non-zero exit status: 41
fs_filesystem/btrfs/test  (Wstat: 10752 Tests: 57 Failed: 42)
  Failed tests:  3, 9-10, 13-26, 28-36, 38-44, 46-54
  Non-zero exit status: 42

See full log here:
https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422684295#L2711

(Don't be confused by the unusual test output - I'm experimenting with
running the tests for all filesystems in a single testsuite run.)

And on related note, the existing vfat tests are also failing:
Test Summary Report
-------------------
filesystem/vfat/test      (Wstat: 7936 Tests: 43 Failed: 31)
  Failed tests:  3-4, 6-7, 10-12, 14-19, 21-22, 24-36, 38-40
  Non-zero exit status: 31
fs_filesystem/vfat/test   (Wstat: 8192 Tests: 42 Failed: 32)
  Failed tests:  3, 5-7, 10-20, 22-35, 37-39
  Non-zero exit status: 32

Full log here: https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422652226#L2703

> The tests/fs_filesystem fail 42 of 57 using './test -f btrfs' on Fedora 32.
>
> As Fedora 33/Rawhide now defaults to using btrfs, running 'make test' will
> fail 42 of 57 fs_filesystem tests (tested on Rawhide).
>
> These fs_filesystem failures are caused by a bug when using the fsmount(2)
> type calls that was reported in [1].

I'll try to dig into this a little bit. It seems that FS maintainers
are not interested :(

>
> Note btrfs requires a much larger image size (min 115 MiB), and therefore
> takes more than 2x longer to run tests than ext4.
>
> [1] https://lore.kernel.org/selinux/c02674c970fa292610402aa866c4068772d9ad4e.camel@btinternet.com/
>
> Richard Haines (1):
>   selinux-testsuite: Add BTRFS support for filesystem tests
>
>  tests/filesystem/Filesystem.pm | 10 +++++++++-
>  tests/filesystem/test          |  6 ++++++
>  tests/fs_filesystem/test       |  6 ++++++
>  3 files changed, 21 insertions(+), 1 deletion(-)
>
> --
> 2.26.2
>

--
Ondrej Mosnacek
Software Engineer, Platform Security - SELinux kernel
Red Hat, Inc.
Ondrej Mosnacek Oct. 30, 2020, 11:44 p.m. UTC | #2
On Fri, Oct 30, 2020 at 10:55 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> On Tue, Oct 13, 2020 at 4:55 PM Richard Haines
> <richard_c_haines@btinternet.com> wrote:
> >
> > This patch allows BTRFS filesystems to be tested.
> >
> > The tests/filesystem all pass using './test -f btrfs' on Fedora 32.
>
> For me, also these tests are failing (41 of 58):
>
> Test Summary Report
> -------------------
> filesystem/btrfs/test     (Wstat: 10496 Tests: 58 Failed: 41)
>   Failed tests:  3-4, 10, 13-15, 17-25, 27-28, 30-37, 39-45
>                 47-55
>   Non-zero exit status: 41

Oh, never mind... The reason why these were failing was that
btrfs-progs was not installed on the system. After installing that
package, only the fs_filesystem tests fail for btrfs.

Please add btrfs-progs as a dependency to README.md and
travis-ci/run-testsuite.sh in future versions of the patch.

> fs_filesystem/btrfs/test  (Wstat: 10752 Tests: 57 Failed: 42)
>   Failed tests:  3, 9-10, 13-26, 28-36, 38-44, 46-54
>   Non-zero exit status: 42
>
> See full log here:
> https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422684295#L2711
>
> (Don't be confused by the unusual test output - I'm experimenting with
> running the tests for all filesystems in a single testsuite run.)
>
> And on related note, the existing vfat tests are also failing:
> Test Summary Report
> -------------------
> filesystem/vfat/test      (Wstat: 7936 Tests: 43 Failed: 31)
>   Failed tests:  3-4, 6-7, 10-12, 14-19, 21-22, 24-36, 38-40
>   Non-zero exit status: 31
> fs_filesystem/vfat/test   (Wstat: 8192 Tests: 42 Failed: 32)
>   Failed tests:  3, 5-7, 10-20, 22-35, 37-39
>   Non-zero exit status: 32

And this might be the same problem, but with dosfstools... I'll need to check.

>
> Full log here: https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422652226#L2703
>
> > The tests/fs_filesystem fail 42 of 57 using './test -f btrfs' on Fedora 32.
> >
> > As Fedora 33/Rawhide now defaults to using btrfs, running 'make test' will
> > fail 42 of 57 fs_filesystem tests (tested on Rawhide).
> >
> > These fs_filesystem failures are caused by a bug when using the fsmount(2)
> > type calls that was reported in [1].
>
> I'll try to dig into this a little bit. It seems that FS maintainers
> are not interested :(
>
> >
> > Note btrfs requires a much larger image size (min 115 MiB), and therefore
> > takes more than 2x longer to run tests than ext4.
> >
> > [1] https://lore.kernel.org/selinux/c02674c970fa292610402aa866c4068772d9ad4e.camel@btinternet.com/
> >
> > Richard Haines (1):
> >   selinux-testsuite: Add BTRFS support for filesystem tests
> >
> >  tests/filesystem/Filesystem.pm | 10 +++++++++-
> >  tests/filesystem/test          |  6 ++++++
> >  tests/fs_filesystem/test       |  6 ++++++
> >  3 files changed, 21 insertions(+), 1 deletion(-)
> >
> > --
> > 2.26.2
> >
>
> --
> Ondrej Mosnacek
> Software Engineer, Platform Security - SELinux kernel
> Red Hat, Inc.
Ondrej Mosnacek Oct. 31, 2020, 12:04 a.m. UTC | #3
On Sat, Oct 31, 2020 at 12:44 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> On Fri, Oct 30, 2020 at 10:55 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> > And on related note, the existing vfat tests are also failing:
> > Test Summary Report
> > -------------------
> > filesystem/vfat/test      (Wstat: 7936 Tests: 43 Failed: 31)
> >   Failed tests:  3-4, 6-7, 10-12, 14-19, 21-22, 24-36, 38-40
> >   Non-zero exit status: 31
> > fs_filesystem/vfat/test   (Wstat: 8192 Tests: 42 Failed: 32)
> >   Failed tests:  3, 5-7, 10-20, 22-35, 37-39
> >   Non-zero exit status: 32
>
> And this might be the same problem, but with dosfstools... I'll need to check.

Yeah, that was it. With dosfstools installed the tests pass.

There are some fsetfilecon(3) errors visible in the test output, though:
https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422914927#L2697
Ondrej Mosnacek Oct. 31, 2020, 9:03 a.m. UTC | #4
On Sat, Oct 31, 2020 at 12:44 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> On Fri, Oct 30, 2020 at 10:55 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> > On Tue, Oct 13, 2020 at 4:55 PM Richard Haines
> > <richard_c_haines@btinternet.com> wrote:
> > >
> > > This patch allows BTRFS filesystems to be tested.
> > >
> > > The tests/filesystem all pass using './test -f btrfs' on Fedora 32.
> >
> > For me, also these tests are failing (41 of 58):
> >
> > Test Summary Report
> > -------------------
> > filesystem/btrfs/test     (Wstat: 10496 Tests: 58 Failed: 41)
> >   Failed tests:  3-4, 10, 13-15, 17-25, 27-28, 30-37, 39-45
> >                 47-55
> >   Non-zero exit status: 41
>
> Oh, never mind... The reason why these were failing was that
> btrfs-progs was not installed on the system. After installing that
> package, only the fs_filesystem tests fail for btrfs.
>
> Please add btrfs-progs as a dependency to README.md and
> travis-ci/run-testsuite.sh in future versions of the patch.

...and please also don't forget to update defconfig :)
Richard Haines Oct. 31, 2020, 10:57 a.m. UTC | #5
On Sat, 2020-10-31 at 01:04 +0100, Ondrej Mosnacek wrote:
> On Sat, Oct 31, 2020 at 12:44 AM Ondrej Mosnacek <omosnace@redhat.com
> > wrote:
> > On Fri, Oct 30, 2020 at 10:55 PM Ondrej Mosnacek <
> > omosnace@redhat.com> wrote:
> > > And on related note, the existing vfat tests are also failing:
> > > Test Summary Report
> > > -------------------
> > > filesystem/vfat/test      (Wstat: 7936 Tests: 43 Failed: 31)
> > >   Failed tests:  3-4, 6-7, 10-12, 14-19, 21-22, 24-36, 38-40
> > >   Non-zero exit status: 31
> > > fs_filesystem/vfat/test   (Wstat: 8192 Tests: 42 Failed: 32)
> > >   Failed tests:  3, 5-7, 10-20, 22-35, 37-39
> > >   Non-zero exit status: 32
> > 
> > And this might be the same problem, but with dosfstools... I'll
> > need to check.
> 
> Yeah, that was it. With dosfstools installed the tests pass.
> 
> There are some fsetfilecon(3) errors visible in the test output,
> though:
> https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422914927#L2697
> 

These tests pass as for vfat Operation not supported is correct. The
tests just need " 2>&1" added to stop output. I'll submit a patch, also
to add dosfstools (also to travis run-testsuite.sh).

I guess I also really need to add to defconfig:

CONFIG_VFAT_FS=m
Richard Haines Oct. 31, 2020, 11 a.m. UTC | #6
On Sat, 2020-10-31 at 10:03 +0100, Ondrej Mosnacek wrote:
> On Sat, Oct 31, 2020 at 12:44 AM Ondrej Mosnacek <omosnace@redhat.com
> > wrote:
> > On Fri, Oct 30, 2020 at 10:55 PM Ondrej Mosnacek <
> > omosnace@redhat.com> wrote:
> > > On Tue, Oct 13, 2020 at 4:55 PM Richard Haines
> > > <richard_c_haines@btinternet.com> wrote:
> > > > This patch allows BTRFS filesystems to be tested.
> > > > 
> > > > The tests/filesystem all pass using './test -f btrfs' on Fedora
> > > > 32.
> > > 
> > > For me, also these tests are failing (41 of 58):
> > > 
> > > Test Summary Report
> > > -------------------
> > > filesystem/btrfs/test     (Wstat: 10496 Tests: 58 Failed: 41)
> > >   Failed tests:  3-4, 10, 13-15, 17-25, 27-28, 30-37, 39-45
> > >                 47-55
> > >   Non-zero exit status: 41
> > 
> > Oh, never mind... The reason why these were failing was that
> > btrfs-progs was not installed on the system. After installing that
> > package, only the fs_filesystem tests fail for btrfs.
> > 
> > Please add btrfs-progs as a dependency to README.md and
> > travis-ci/run-testsuite.sh in future versions of the patch.
> 
> ...and please also don't forget to update defconfig :)

I'll send updated patch soon.
>
Richard Haines Oct. 31, 2020, 11:05 a.m. UTC | #7
On Sat, 2020-10-31 at 10:57 +0000, Richard Haines wrote:
> On Sat, 2020-10-31 at 01:04 +0100, Ondrej Mosnacek wrote:
> > On Sat, Oct 31, 2020 at 12:44 AM Ondrej Mosnacek <
> > omosnace@redhat.com
> > > wrote:
> > > On Fri, Oct 30, 2020 at 10:55 PM Ondrej Mosnacek <
> > > omosnace@redhat.com> wrote:
> > > > And on related note, the existing vfat tests are also failing:
> > > > Test Summary Report
> > > > -------------------
> > > > filesystem/vfat/test      (Wstat: 7936 Tests: 43 Failed: 31)
> > > >   Failed tests:  3-4, 6-7, 10-12, 14-19, 21-22, 24-36, 38-40
> > > >   Non-zero exit status: 31
> > > > fs_filesystem/vfat/test   (Wstat: 8192 Tests: 42 Failed: 32)
> > > >   Failed tests:  3, 5-7, 10-20, 22-35, 37-39
> > > >   Non-zero exit status: 32
> > > 
> > > And this might be the same problem, but with dosfstools... I'll
> > > need to check.
> > 
> > Yeah, that was it. With dosfstools installed the tests pass.
> > 
> > There are some fsetfilecon(3) errors visible in the test output,
> > though:
> > https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422914927#L2697
> > 
> 
> These tests pass as for vfat Operation not supported is correct. The
> tests just need " 2>&1" added to stop output. I'll submit a patch,
> also
> to add dosfstools (also to travis run-testsuite.sh).
> 

No as already there:
> I guess I also really need to add to defconfig:
> 
> CONFIG_VFAT_FS=m
> 
>
Ondrej Mosnacek Oct. 31, 2020, 11:27 a.m. UTC | #8
On Sat, Oct 31, 2020 at 11:58 AM Richard Haines
<richard_c_haines@btinternet.com> wrote:
> On Sat, 2020-10-31 at 01:04 +0100, Ondrej Mosnacek wrote:
> > On Sat, Oct 31, 2020 at 12:44 AM Ondrej Mosnacek <omosnace@redhat.com
> > > wrote:
> > > On Fri, Oct 30, 2020 at 10:55 PM Ondrej Mosnacek <
> > > omosnace@redhat.com> wrote:
> > > > And on related note, the existing vfat tests are also failing:
> > > > Test Summary Report
> > > > -------------------
> > > > filesystem/vfat/test      (Wstat: 7936 Tests: 43 Failed: 31)
> > > >   Failed tests:  3-4, 6-7, 10-12, 14-19, 21-22, 24-36, 38-40
> > > >   Non-zero exit status: 31
> > > > fs_filesystem/vfat/test   (Wstat: 8192 Tests: 42 Failed: 32)
> > > >   Failed tests:  3, 5-7, 10-20, 22-35, 37-39
> > > >   Non-zero exit status: 32
> > >
> > > And this might be the same problem, but with dosfstools... I'll
> > > need to check.
> >
> > Yeah, that was it. With dosfstools installed the tests pass.
> >
> > There are some fsetfilecon(3) errors visible in the test output,
> > though:
> > https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422914927#L2697
> >
>
> These tests pass as for vfat Operation not supported is correct. The
> tests just need " 2>&1" added to stop output. I'll submit a patch, also
> to add dosfstools (also to travis run-testsuite.sh).

You can skip the dosfstools, I have a patch ready for that (it will
also add e2fsprogs and jfsutils, which are also missing). You might
also want to delay respinning the btrfs patch for after my "multi-fs
filesystem test" patches (it will need small tweaks to align with
that). Stay tuned, I should have the patches ready by today :)
Richard Haines Oct. 31, 2020, 11:40 a.m. UTC | #9
On Sat, 2020-10-31 at 12:27 +0100, Ondrej Mosnacek wrote:
> On Sat, Oct 31, 2020 at 11:58 AM Richard Haines
> <richard_c_haines@btinternet.com> wrote:
> > On Sat, 2020-10-31 at 01:04 +0100, Ondrej Mosnacek wrote:
> > > On Sat, Oct 31, 2020 at 12:44 AM Ondrej Mosnacek <
> > > omosnace@redhat.com
> > > > wrote:
> > > > On Fri, Oct 30, 2020 at 10:55 PM Ondrej Mosnacek <
> > > > omosnace@redhat.com> wrote:
> > > > > And on related note, the existing vfat tests are also
> > > > > failing:
> > > > > Test Summary Report
> > > > > -------------------
> > > > > filesystem/vfat/test      (Wstat: 7936 Tests: 43 Failed: 31)
> > > > >   Failed tests:  3-4, 6-7, 10-12, 14-19, 21-22, 24-36, 38-40
> > > > >   Non-zero exit status: 31
> > > > > fs_filesystem/vfat/test   (Wstat: 8192 Tests: 42 Failed: 32)
> > > > >   Failed tests:  3, 5-7, 10-20, 22-35, 37-39
> > > > >   Non-zero exit status: 32
> > > > 
> > > > And this might be the same problem, but with dosfstools... I'll
> > > > need to check.
> > > 
> > > Yeah, that was it. With dosfstools installed the tests pass.
> > > 
> > > There are some fsetfilecon(3) errors visible in the test output,
> > > though:
> > > https://travis-ci.com/github/WOnder93/selinux-testsuite/jobs/422914927#L2697
> > > 
> > 
> > These tests pass as for vfat Operation not supported is correct.
> > The
> > tests just need " 2>&1" added to stop output. I'll submit a patch,
> > also
> > to add dosfstools (also to travis run-testsuite.sh).
> 
> You can skip the dosfstools, I have a patch ready for that (it will
> also add e2fsprogs and jfsutils, which are also missing). You might
> also want to delay respinning the btrfs patch for after my "multi-fs
> filesystem test" patches (it will need small tweaks to align with
> that). Stay tuned, I should have the patches ready by today :)
> 

Thanks for the update - I'll wait for your patches.
Stephen Smalley Nov. 2, 2020, 7:20 p.m. UTC | #10
On Fri, Oct 30, 2020 at 5:56 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> On Tue, Oct 13, 2020 at 4:55 PM Richard Haines
> <richard_c_haines@btinternet.com> wrote:
> > These fs_filesystem failures are caused by a bug when using the fsmount(2)
> > type calls that was reported in [1].
>
> I'll try to dig into this a little bit. It seems that FS maintainers
> are not interested :(

For further context and the corresponding fix for nfs, see
https://github.com/SELinuxProject/selinux-kernel/issues/49.
Ondrej Mosnacek Nov. 2, 2020, 7:52 p.m. UTC | #11
On Mon, Nov 2, 2020 at 8:20 PM Stephen Smalley
<stephen.smalley.work@gmail.com> wrote:
> On Fri, Oct 30, 2020 at 5:56 PM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> >
> > On Tue, Oct 13, 2020 at 4:55 PM Richard Haines
> > <richard_c_haines@btinternet.com> wrote:
> > > These fs_filesystem failures are caused by a bug when using the fsmount(2)
> > > type calls that was reported in [1].
> >
> > I'll try to dig into this a little bit. It seems that FS maintainers
> > are not interested :(
>
> For further context and the corresponding fix for nfs, see
> https://github.com/SELinuxProject/selinux-kernel/issues/49.

Hm... I was running the reproducer a few days ago on a kernel that
should have that fix (I think), and yet I'd swear I was still able to
reproduce the bug... It's possible I made a mistake somewhere, but it
might be that it's still not actually fixed (or reappeared again).
I'll continue investigating it hopefully sometime this week.

I also dug into the btrfs bug and it seems to have a slightly
different (albeit similar) cause. I think I have a possible fix, but I
haven't yet had time to fully finalize it and test it. I'll report
back once I have something final.