All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Richard Haines <richard_c_haines@btinternet.com>,
	selinux@vger.kernel.org
Subject: Re: [RFC PATCH 0/1] selinux-testsuite: Test all mount option context types
Date: Tue, 4 Feb 2020 13:22:46 -0500	[thread overview]
Message-ID: <ad706239-69a1-eeae-31ce-ac8b70081613@tycho.nsa.gov> (raw)
In-Reply-To: <20200204143707.318337-1-richard_c_haines@btinternet.com>

On 2/4/20 9:37 AM, Richard Haines wrote:
> Not sure how useful these tests are but using them as a starter for running
> tests on all supported filesystems (that I could find).
> 
> These test all the *context= mount options by reading /sbin/mkfs.* entries.
> I've failed/passed tests based on what I have seen, however some could be
> wrong.

A few preliminary comments:

- The existence of /sbin/mkfs.foo does not guarantee that the kernel 
config enables the foo filesystem,

- I'm not sure that we really want to test all of these filesystem types 
all the time; my earlier comments were more directed at enabling us to 
apply as many of the existing filesystem + fs_filesystem tests as 
possible to whatever filesystem type is in use as the native/host 
filesystem type in which selinux-testsuite lives as is the case for all 
other tests, so that distributions with different defaults will get 
their own defaults tested automatically (e.g. ext4 vs xfs vs btrfs) when 
run on their distribution and labeled NFS will be fully exercised when 
running nfs.sh,

- Only exercising fsconfig(2) without actually mounting won't tell us if 
the context is actually being applied as expected, unlike the existing 
filesystem tests,

- Fail/pass shouldn't be based on what we happen to see when we run the 
test but on what is known to be the actual correct behavior. Offhand, 
the only cases expected to fail if allowed by policy would be use of any 
of the context mount options in a non-init user namespace (except for 
tmpfs/ramfs/devpts) or use of defcontext= with a filesystem type that 
isn't fs_use_xattr in policy or using native labeling (labeled NFS).

> 
> Notes:
> 1) As I use fsconfig(2), the btrfs tests will always fail as there is a
>     bug somewhere in the kernel (being investigated).
> 2) I have had to disable udisks as that interferes with the tests. You can
>     keep it enabled by ./test -e.
>     I think there is really a problem with udisks getting in the way as I
>     rapidly fsopen(fd), fsconfig(2) close(fd) for each test (on my system
>     this equals 48 times).
> 
> Richard Haines (1):
>    selinux-testsuite: Test all mount option context types
> 
>   policy/test_filesystem.te      |  12 +++
>   tests/Makefile                 |   2 +-
>   tests/filesystem/Filesystem.pm |  19 +++-
>   tests/fs_contexts/.gitignore   |   1 +
>   tests/fs_contexts/Makefile     |  13 +++
>   tests/fs_contexts/fsconfig.c   |  72 ++++++++++++++++
>   tests/fs_contexts/test         | 153 +++++++++++++++++++++++++++++++++
>   7 files changed, 268 insertions(+), 4 deletions(-)
>   create mode 100644 tests/fs_contexts/.gitignore
>   create mode 100644 tests/fs_contexts/Makefile
>   create mode 100644 tests/fs_contexts/fsconfig.c
>   create mode 100755 tests/fs_contexts/test



      parent reply	other threads:[~2020-02-04 19:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 14:37 [RFC PATCH 0/1] selinux-testsuite: Test all mount option context types Richard Haines
2020-02-04 14:37 ` [RFC PATCH 1/1] " Richard Haines
2020-02-04 18:22 ` Stephen Smalley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad706239-69a1-eeae-31ce-ac8b70081613@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=richard_c_haines@btinternet.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.