Commit graph

39 commits

Author SHA1 Message Date
Ondrej Mosnacek
b44912d7d8 kernel/selinux-testsuite: remove redundant and obsolete dependencies
libselinux and selnux-policy are already required by their -devel
counterparts (and other packages), libsemanage is also not required
directly, and platform-python was only needed on earlier RHEL-8.0 dev
composes where python3 wasn't installable directly (and I suspect that
it wouldn't help there, anyway...).

Note that this also works around:
https://bugzilla.redhat.com/show_bug.cgi?id=1876847

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-09-15 16:53:22 +02:00
Ondrej Mosnacek
792c484e81 kernel/selinux-testsuite: add nftables to dependencies
It enables some extra sctp and inet_socket tests when installed.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-08-27 15:53:08 +02:00
Ondrej Mosnacek
1da6083aa2 kernel/selinux-testsuite: extend SCTP test coverage
Add another global IPv4 address by creating a dummy GRE interface in
order to activate two extra SCTP tests that require two unique global
IPv4 addresses.

Before (F32):
Files=61, Tests=832, 176 wallclock secs ( 0.59 usr  0.13 sys +  4.92 cusr  6.54 csys = 12.18 CPU)

After (F32):
Files=61, Tests=834, 182 wallclock secs ( 0.66 usr  0.11 sys +  6.28 cusr  7.68 csys = 14.73 CPU)

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-08-27 15:33:50 +02:00
Ondrej Mosnacek
dc137b132e kernel/selinux-testsuite: change CKI workaround detection
Recently there were some changes in CKI upstream kernel building and the
old bugginess detection doesn't work any more. Fix it to use adifferent
build program, which is still missing.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-08-06 19:16:43 +02:00
Ondrej Mosnacek
c63ac79b2e kernel/labeled-cephfs: test also special file types
An issue was found in CephFS that caused symlinks to be left unlabeled
upon creation. Extend the test to cover also symlinks, special file
types, and directories.

Upstream fix: https://marc.info/?l=ceph-devel&m=159596407215153&w=2

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-08-05 09:15:32 +02:00
Ondrej Mosnacek
10f9a3da40 kernel/selinux-testsuite: bump upstream ref
Highlights:
 - Use native filesystem for FS tests
 - Avoid mmap test failures when /dev is mounted noexec
 - Add nftables to inet_socket and sctp tests
 - Fix overlayfs test false positive on new kernels (previously applied
   as a patch)
 - Add check for key changes on watch_queue

Several RHEL workarounds were needed, see the diff for details.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-07-15 13:37:11 +02:00
Ondrej Mosnacek
a5ae35d6af kernel/selinux-testsuite: fix existence check in boolSet
When the boolean name passed to boolSet is an alias, then the current
implementation would always skip setting the boolean. That in turn
causes allow_domain_fd_use to remain unset when it is an alias and the
testsuite fails (because it then doesn't reset the value due to `make`
logic). That can cause AVCs in later tests and so needs to be fixed.

The fix is to just try `getsebool <name>` instead of grepping `getsebool
-a` for the boolean name.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-07-15 10:50:18 +02:00
Ondrej Mosnacek
b5ba44ae54 kernel/selinux-testsuite: abort the test when infra fails
CKI interprets the "Abort" result as an infra failure and waives the
test in such case. So if "git clone" fails, it's better to abort the
whole test so that a false positive test failure is not reported.

Turns out that Beaker interprets the exit code 127 (possibly other ones,
but this one I'm sure about) as Abort, so we can just do that instead of
relying on the legacy rhts-abort command.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-06-25 10:12:31 +02:00
Ondrej Mosnacek
af8c17c2ef kernel/selinux-testsuite: apply overlay test fix
There is a new permission required to create whiteout nodes, causing the
test to fail on fresh mainline kernels. Apply the patch from Stephen
Smalley to fix that until we pick it up in a rebase.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-06-03 10:36:21 +02:00
Ondrej Mosnacek
292f0937be kernel/selinux-testsuite: work around CKI BTF issue
The CKI kernels are cross-compiled on x86_64, so they generate an
invalid (little-endian) in-kernel BTF on big-endian systems. Work around
this by skipping the BPF test if little-endian BTF is detected on s390x.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-06-01 19:17:25 +02:00
Ondrej Mosnacek
d9f666535c selinux-testsuite: drop unused dep on ipsec-tools
Nothing from there seems to be actually used by the testsuite and it's
not even shipped on recent RHELs.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-04-29 17:30:09 +02:00
Ondrej Mosnacek
2d4ef6a0da kernel: add test for CephFS labeling
The test verifies expected behavior of CephFS security label support
across distros.

Note that for the test to work RHEL, an appropriate Ceph repo must be
installed. A scriptlet that sets this up can be provided via the
INSTALL_SCRIPTLET parameter.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-04-21 11:38:54 +02:00
Ondrej Mosnacek
382ea52b68 kernel/selinux-testsuite: bump upstream ref
...and remove a workaround that is now obsoleted by an upstream patch.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-04-16 23:51:32 +02:00
Ondrej Mosnacek
1487aa5b49 kernel/selinux-testsuite: don't include rhts-environment.sh
It appears to be unnecessary.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-21 12:33:54 +01:00
Ondrej Mosnacek
b8fea46da7 kernel/selinux-testsuite: bump ref for glblub test
Bump upstream commit to include the new glblub test and drop the patch
that is also included in upstream now.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-20 18:16:31 +01:00
Ondrej Mosnacek
f2a19e494f kernel/selinux-testsuite: put back libbpf-devel CRB workaround
It turns out that in CKI's kickstart the CRB repo is enabled by default,
but this is not true for the usual beaker install. Thus, try to install
libbpf-devel from the usual CRB repo names. Yes, it's an ugly
workaround, but there's currently no better way.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-16 11:33:03 +01:00
Ondrej Mosnacek
f75369820f kernel/selinux-testuite: skip BPF tests on RHEL < 8.2
The libbpf package is only available starting with RHEL-8.2.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-13 09:25:15 +01:00
Ondrej Mosnacek
16db29b379 kernel/selinux-testuite: apply BPF test fix from Patchwork
Add a patch that fixes failures on aarch64 and ppc64le due to
insufficient RLIMIT_MEMLOCK.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-12 10:03:14 +01:00
Ondrej Mosnacek
f94e8d99f1 selinux-testsuite: bump upstream ref
This mainly adds fs_* mount API tests.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-11 13:47:52 +01:00
Ondrej Mosnacek
097169c779 selinux-testsuite: avoid unsafe tweaks
Replacing kernel version occurences is problematic when different tests
have the same bounding kernel version, as is true for current upstream.
Therefore, replace it with adding "force_tests" list that works
similarly to the existing "exclude_tests" list, but forces execution of
the tests instead of excluding them.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-11 13:10:22 +01:00
Ondrej Mosnacek
9059d13bd3 kernel/selinux-testsuite: remove libbpf-devel CRB workaround
On Beaker the repo has a different name and CRB is enabled there anyway.
This workaround is only useful with the internal 1minutetip tool, so
it's not worth keeping it here.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-10 19:54:37 +01:00
Ondrej Mosnacek
a3e35f88ec kernel/selinux-testsuite: handle BPF restrictions better
On RHEL and non-x86_64 Fedora kernels, the kernel.unprivileged_bpf_disabled
sysctl is enabled by default (and at least on RHEL/ARK it cannot be
changed). Instead of trying to disable the BPF subtest completely on
these kernels (which is incomplete since CKI tests ARK kernels on
Fedora), add the sys_admin capability to the BPF test domains to make
the test work on these kernels as well.

We also need to install libbpf-devel separately from CRB on RHEL, since
it's not shipped in BaseOS.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-09 14:29:00 +01:00
Ondrej Mosnacek
26fd2feb94 kernel/selinux-testsuite: fix module_load check
The "conmakehash" program is not shipped on recent Fedora kernels (and
who knows where else). Switch to "unifdef", which seems to be everywhere
(and always an ELF executable).

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-03-03 12:36:22 +01:00
Ondrej Mosnacek
fbff736aea selinux-testuite: add a patch to fix SCTP test issue
This fixes failing CKI stable kernel testing.
See: https://patchwork.kernel.org/patch/11400391/

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-02-25 10:46:46 +01:00
Ondrej Mosnacek
7c17683e19 selinux-testsuite: bump upstream ref
This pulls in new filesystem tests + a fix for building under GCC 10.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-01-25 14:56:21 +01:00
Ondrej Mosnacek
a0b957b7d7 selinux-testsuite: bump upstream commit ref
The only significant change that this pulls in is 7fd02b152f9f
("tests/prlimit: avoid invalid limit combinations"), which fixes false
test failures in some environments.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-01-14 13:01:40 +01:00
Ondrej Mosnacek
af8cdd2711 selinux-testsuite: enable PATH records while running
This helps when debugging unexpected AVCs. This was formerly done by the
selinux-policy/common library, which the test doesn't use any more, so
let's add this useful feature back with just four simple commands.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-01-02 13:22:13 +01:00
Ondrej Mosnacek
c377fe7bc1 selinux-testsuite: extend the CKI workaround
CKI RHEL-8 builds are cross-compiled badly, so disable module_load also
when the kernel-devel built helper programs are unusable.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-28 13:46:20 +01:00
Ondrej Mosnacek
221a043be0 selinux-testsuite: do not check kernel RPM
The RPM is not important, what is important is the running kernel (and
that can't be missing, obviously) and its version is already shown
elsewhere.

Moe importantly, in Fedora CI the 'kernel' RPM may not even be there, so
the test would warn about it, causing failures.

Reported-by: Lukas Vrabec <lvrabec@redhat.com>
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-22 15:16:41 +01:00
Ondrej Mosnacek
eb84c723c3 selinux-testsuite: move to Tier 2
...because tier 1 tests are ran for all SELinux components, which is
alittle too often for this not-so-lightweight test.

Suggested-by: Petr Lautrbach <plautrba@redhat.com>
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-22 15:16:41 +01:00
Ondrej Mosnacek
c938713b3c selinux-testsuite: do not use non-existent function
There is no rlWarn, should have been rlLogWarning.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-22 15:16:41 +01:00
Ondrej Mosnacek
bc0203d06f selinux-testsuite: enable pipefail when applying patches
We want the command to fail if curl fails.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-22 15:16:41 +01:00
Ondrej Mosnacek
824ac3234f selinux-testsuite: bump upstream commit ref
This adds three new tests: tun_tap, socketpair, and perf.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-22 15:14:49 +01:00
Ondrej Mosnacek
50a1ccb0d5 selinux-testsuite: skip module_load test when we can't run it
CKI mainline kernel packages don't currently provide the files necessary
to build kernel modules. Work around it by disabling the module_load
subtest when the files are missing.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-13 10:27:52 +01:00
Ondrej Mosnacek
905952c0a5 selinux-testsuite: use correct selinuxfs mount
On RHEL-6 selinuxfs is at /selinux instead of /sys/fs/selinux.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-13 10:27:47 +01:00
Ondrej Mosnacek
06d0fd4627 selinux-testsuite: do make clean silently
Makes it easier to scroll through the logs and exposes some error
output on RHEL-6.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-13 10:19:52 +01:00
Ondrej Mosnacek
45f2938c61 selinux-testsuite: consolidate network timeouts
There are several places in the testuite that set timeouts for network
operations. They use different values in different places and
particularly for the SCTP test the value is too small on some machines
and often leads to false-positive test failures.

Since the right value depends on the environment, rather than proposing
to change the value to some guessed number upstream, let's just tweak
the number from the wrapper and suggest updating the numbers upstream
once we find a "proven" good value.

I'm setting the default to 4 secs - 1 second higher than the old value
in the inet_socket test, where we also (very) sporadically get failures.
The most problematic SCTP subtest had 2 seconds timeout before.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-11 09:22:45 +01:00
Ondrej Mosnacek
bff670d22b selinux-testuite: add iptables to requires
It is usually already installed so this hasn't been spotted before,
however on Fedora CI the missing requirement causes a failure.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-09 14:08:11 +01:00
Ondrej Mosnacek
8d56126586 kernel: Add selinux-testsuite test
Add the beakerlib wrapper for selinux-testuite so it can be used from
elsewhere.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2019-12-06 13:42:36 +01:00