selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] selinux-testsuite: Use native filesystem for fs tests
@ 2020-02-13 16:30 Richard Haines
  2020-02-13 20:55 ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Haines @ 2020-02-13 16:30 UTC (permalink / raw)
  To: selinux; +Cc: Richard Haines

This is a first attempt at running the filesystem and fs_filesystem tests
on the native filesystem.

It supports NFS when using the tools/nfs.sh script. NFS will support options
with rootcontext and fscontext, however due to the fsconfig(2) they bug will
not pass with these (see note in nfs.sh).

The filesystem types supported are: ext2, ext3, ext4, xfs, btrfs, hfsplus,
reiserfs, nfs4. If not in this list, tests are skipped. I'm not sure what
others need supporting, these seem reasonable and available on Fedora.

I've had to add a number of policy rules to support these types, however
I've made no attempt to consolidate them. Most are for supporting rootcontext
and fscontext on NFS. Rules for the 'context' option were many more so
decided not to add them - any views on this.

When testing btrfs, most tests will fail on tests/fs_filesystem due to
the fsconfig(2) bug.

I've had to finally disable udisk2(8) as it interferes with the tests. It
can be enabled locally with the -e flag. I'm sure there is a bug somewhere.

In the filesystem/test I've comments regarding quotas, as some fs require
different utilities to set them up. I've not tried these - any views.

This does need more testing, particularly on a 'real' NFS mounted system (not
tested). All feedback welcome.

Richard Haines (1):
  selinux-testsuite: Use native filesystem for fs tests

 policy/test_filesystem.te        | 122 ++++++-
 policy/test_filesystem_notify.te |  50 ++-
 tests/filesystem/Filesystem.pm   |  19 +-
 tests/filesystem/test            | 399 ++++++++++++---------
 tests/filesystem/test-nfs.pl     | 526 ++++++++++++++++++++++++++++
 tests/fs_filesystem/test         | 405 +++++++++++++---------
 tests/fs_filesystem/test-nfs.pl  | 576 +++++++++++++++++++++++++++++++
 tools/nfs.sh                     |  16 +
 8 files changed, 1795 insertions(+), 318 deletions(-)
 create mode 100755 tests/filesystem/test-nfs.pl
 create mode 100755 tests/fs_filesystem/test-nfs.pl

-- 
2.24.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 0/1] selinux-testsuite: Use native filesystem for fs tests
  2020-02-13 16:30 [RFC PATCH 0/1] selinux-testsuite: Use native filesystem for fs tests Richard Haines
@ 2020-02-13 20:55 ` Stephen Smalley
  2020-02-13 21:00   ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2020-02-13 20:55 UTC (permalink / raw)
  To: Richard Haines, selinux

On 2/13/20 11:30 AM, Richard Haines wrote:
> This is a first attempt at running the filesystem and fs_filesystem tests
> on the native filesystem.
> 
> It supports NFS when using the tools/nfs.sh script. NFS will support options
> with rootcontext and fscontext, however due to the fsconfig(2) they bug will
> not pass with these (see note in nfs.sh).
> 
> The filesystem types supported are: ext2, ext3, ext4, xfs, btrfs, hfsplus,
> reiserfs, nfs4. If not in this list, tests are skipped. I'm not sure what
> others need supporting, these seem reasonable and available on Fedora.

Didn't receive the patch but will comment on a few items in your cover 
letter.

Offhand, I'd suggest pruning it to just ext4, xfs, and nfs4.  There is 
no separate ext3 filesystem in the kernel anymore (ext4 provides the 
implementation for both ext3 and ext4).  ext2 and reiserfs seem to be 
legacy filesystems and reiserfs never supported SELinux well to my 
knowledge.  btrfs SELinux support seems to not be well supported; absent 
a distro supporting them both that seems unlikely to change. hfsplus is 
orphaned per MAINTAINERS and not likely to be used as a primary 
filesystem for SELinux regardless.

> I've had to add a number of policy rules to support these types, however
> I've made no attempt to consolidate them. Most are for supporting rootcontext
> and fscontext on NFS. Rules for the 'context' option were many more so
> decided not to add them - any views on this.

Wasn't sure what issue you are encountering there.  Could you use an 
attribute ala file_type and/or fs_type or the corresponding refpolicy 
interfaces to allow what you need with just a few rules?
> When testing btrfs, most tests will fail on tests/fs_filesystem due to
> the fsconfig(2) bug.

Yes, I'm disinclined to include btrfs in our testing until/unless a 
SELinux maintainer is using a distro that defaults to it (or the 
maintainer defaults to using it regardless) and ensures that it is kept 
functioning.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 0/1] selinux-testsuite: Use native filesystem for fs tests
  2020-02-13 20:55 ` Stephen Smalley
@ 2020-02-13 21:00   ` Stephen Smalley
  2020-02-13 22:28     ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2020-02-13 21:00 UTC (permalink / raw)
  To: Richard Haines, selinux

On 2/13/20 3:55 PM, Stephen Smalley wrote:
> On 2/13/20 11:30 AM, Richard Haines wrote:
>> This is a first attempt at running the filesystem and fs_filesystem tests
>> on the native filesystem.
>>
>> It supports NFS when using the tools/nfs.sh script. NFS will support 
>> options
>> with rootcontext and fscontext, however due to the fsconfig(2) they 
>> bug will
>> not pass with these (see note in nfs.sh).
>>
>> The filesystem types supported are: ext2, ext3, ext4, xfs, btrfs, 
>> hfsplus,
>> reiserfs, nfs4. If not in this list, tests are skipped. I'm not sure what
>> others need supporting, these seem reasonable and available on Fedora.
> 
> Didn't receive the patch but will comment on a few items in your cover 
> letter.
> 
> Offhand, I'd suggest pruning it to just ext4, xfs, and nfs4.  There is 
> no separate ext3 filesystem in the kernel anymore (ext4 provides the 
> implementation for both ext3 and ext4).  ext2 and reiserfs seem to be 
> legacy filesystems and reiserfs never supported SELinux well to my 
> knowledge.  btrfs SELinux support seems to not be well supported; absent 
> a distro supporting them both that seems unlikely to change. hfsplus is 
> orphaned per MAINTAINERS and not likely to be used as a primary 
> filesystem for SELinux regardless.
> 
>> I've had to add a number of policy rules to support these types, however
>> I've made no attempt to consolidate them. Most are for supporting 
>> rootcontext
>> and fscontext on NFS. Rules for the 'context' option were many more so
>> decided not to add them - any views on this.
> 
> Wasn't sure what issue you are encountering there.  Could you use an 
> attribute ala file_type and/or fs_type or the corresponding refpolicy 
> interfaces to allow what you need with just a few rules?
>> When testing btrfs, most tests will fail on tests/fs_filesystem due to
>> the fsconfig(2) bug.
> 
> Yes, I'm disinclined to include btrfs in our testing until/unless a 
> SELinux maintainer is using a distro that defaults to it (or the 
> maintainer defaults to using it regardless) and ensures that it is kept 
> functioning.

Actually, I take that back.  I wouldn't want the testsuite to 
automatically try to create and test btrfs filesystems itself, but if 
you are just whitelisting on which filesystem types the testsuite will 
try to apply its tests when run there, including btrfs makes sense. 
Then it won't break automated testing runs on distros not using btrfs 
but we can still refer btrfs developers to the testsuite to identify and 
reproduce bugs/regressions.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH 0/1] selinux-testsuite: Use native filesystem for fs tests
  2020-02-13 21:00   ` Stephen Smalley
@ 2020-02-13 22:28     ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2020-02-13 22:28 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: Richard Haines, selinux

On Thu, Feb 13, 2020 at 3:59 PM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 2/13/20 3:55 PM, Stephen Smalley wrote:
> > On 2/13/20 11:30 AM, Richard Haines wrote:
> >> This is a first attempt at running the filesystem and fs_filesystem tests
> >> on the native filesystem.
> >>
> >> It supports NFS when using the tools/nfs.sh script. NFS will support
> >> options
> >> with rootcontext and fscontext, however due to the fsconfig(2) they
> >> bug will
> >> not pass with these (see note in nfs.sh).
> >>
> >> The filesystem types supported are: ext2, ext3, ext4, xfs, btrfs,
> >> hfsplus,
> >> reiserfs, nfs4. If not in this list, tests are skipped. I'm not sure what
> >> others need supporting, these seem reasonable and available on Fedora.
> >
> > Didn't receive the patch but will comment on a few items in your cover
> > letter.
> >
> > Offhand, I'd suggest pruning it to just ext4, xfs, and nfs4.  There is
> > no separate ext3 filesystem in the kernel anymore (ext4 provides the
> > implementation for both ext3 and ext4).  ext2 and reiserfs seem to be
> > legacy filesystems and reiserfs never supported SELinux well to my
> > knowledge.  btrfs SELinux support seems to not be well supported; absent
> > a distro supporting them both that seems unlikely to change. hfsplus is
> > orphaned per MAINTAINERS and not likely to be used as a primary
> > filesystem for SELinux regardless.
> >
> >> I've had to add a number of policy rules to support these types, however
> >> I've made no attempt to consolidate them. Most are for supporting
> >> rootcontext
> >> and fscontext on NFS. Rules for the 'context' option were many more so
> >> decided not to add them - any views on this.
> >
> > Wasn't sure what issue you are encountering there.  Could you use an
> > attribute ala file_type and/or fs_type or the corresponding refpolicy
> > interfaces to allow what you need with just a few rules?
> >> When testing btrfs, most tests will fail on tests/fs_filesystem due to
> >> the fsconfig(2) bug.
> >
> > Yes, I'm disinclined to include btrfs in our testing until/unless a
> > SELinux maintainer is using a distro that defaults to it (or the
> > maintainer defaults to using it regardless) and ensures that it is kept
> > functioning.
>
> Actually, I take that back.  I wouldn't want the testsuite to
> automatically try to create and test btrfs filesystems itself, but if
> you are just whitelisting on which filesystem types the testsuite will
> try to apply its tests when run there, including btrfs makes sense.
> Then it won't break automated testing runs on distros not using btrfs
> but we can still refer btrfs developers to the testsuite to identify and
> reproduce bugs/regressions.

I would agree with that.

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-13 22:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 16:30 [RFC PATCH 0/1] selinux-testsuite: Use native filesystem for fs tests Richard Haines
2020-02-13 20:55 ` Stephen Smalley
2020-02-13 21:00   ` Stephen Smalley
2020-02-13 22:28     ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).