Commit graph

68 commits

Author SHA1 Message Date
Ondrej Mosnacek
d96170f110 kernel/selinux-testsuite: Bump upstream commit
This pulls in a fix to account for the following kernel commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.12&id=db2e718a47984b9d71ed890eb2ea36ecf150de18

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-04-28 16:36:06 +02:00
Ondrej Mosnacek
8ea2e4bd98 Add a basic test for SELinux AVC tracepoint
See the test description for more info.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-04-28 15:18:14 +02:00
Ondrej Mosnacek
6fc1caeb52 Add a minimal test for the recent setsebool kernel regression
It doesn't have a bugzilla, but better to have a regression test for it.
It's a very low-effort test, but still better than nothing :)

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-04-27 11:00:42 +02:00
Ondrej Mosnacek
e6f890f6ce kernel/netlabel_many_ifaces: fix relevancy for RHEL
The bug was only fixed in RHEL-8.4, so disable the tests on anything
older.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-04-16 20:51:37 +02:00
Ondrej Mosnacek
d85b0bfed9 kernel/selinux-testsuite: Bump upstream commit
...to pull in two fixes for the userfaultfd test so it builds
sucessfully on RHEL-7 and remove the associated workaround from the
wrapper.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-04-08 12:02:58 +02:00
Ondrej Mosnacek
9f4cbb46a4 Fix invalid FMF syntax
Fixes:
Invalid yaml syntax: Failed to parse '/home/omosnace/Dokumenty/Fedora/tests/selinux/kernel/genfs_fallback/main.fmf'.
Duplicate key 'adjust' detected.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-04-06 15:25:20 +02:00
Ondrej Mosnacek
6548af6fcf Add test for genfscon fallback support
This feature is required for proper support of virtiofs with SELinux.
Add a trivial test that verifies that this feature works via a dummy
SELinux module and ramfs mount.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-03-26 14:30:48 +01:00
Ondrej Mosnacek
60c10ba7e1 kernel/selinux-testsuite: exclude userfaultfd on old kernels
On RHEL-7 (and other old kernels), __NR_userfaultfd may not be defined
on some arches, so add a kernel version check for now to exclude
userfaultfd test when it would be skipped anyway.

I'll fix this more nicely in upstream, this is just a temporary solution
until that gets merged.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-03-09 15:40:01 +01:00
Ondrej Mosnacek
3915ebfb3d kernel/selinux-testsuite: Bump upstream commit
Highlights:
- fixed lockdown and perf_event tests to work with latest Fedora policy
- userfaultfd test added
- removed dependency on `which`

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-03-04 12:39:46 +01:00
Ondrej Mosnacek
fa3b0fe2ce kernel/synflood: disable on s390x
There are no s390x machines with enough cores to run this test in RH's
Beaker and likely won't be available in any CI system in the near
future. Thus, exclude the test from this arch so that testing doesn't
fail due to lack of matching hardware.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-02-24 16:39:59 +01:00
Ondrej Mosnacek
a01344bd64 Add test for kernel deadlock via setsebool
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-02-03 18:31:03 +01:00
Ondrej Mosnacek
cf69ccdee8 kernel/selinux-testsuite: ensure test policy is fully unloaded
Since the testsuite now loads more policy modules, the `semodule -r
test_policy` command is not enough for a full cleanup. Do `make -C
policy unload instead`.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-25 13:21:39 +01:00
Ondrej Mosnacek
602c2e9fe6 kernel/selinux-testsuite: clean up make_vars usage
Define it in a more suitable place and use it also for `make clean`.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-25 13:21:39 +01:00
Ondrej Mosnacek
893ed4c898 selinux-testsuite: Bump to latest upstream commit
Brings in two bugfixes to adapt to changes in Fedora policy.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-19 18:07:52 +01:00
Ondrej Mosnacek
5e0275eb2f kernel/synflood: require at least 64 cores and 2 NUMA nodes
Based on several runs in Beaker, these seem to be the best conditions
for distinguishing the bug. Currently, legacy Beaker HW filters are used
in the metadata. Once TMT introduces support for generic HW
requirements, they will need to be converted to the new format.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-19 14:04:27 +01:00
Ondrej Mosnacek
a358f02d2f kernel/synflood: reduce sampling time and increase duration
On fast systems with a lot of cores the 10s synflood run produces too
large perf.data (> 1 GiB), so reduce it to 5s and also increase the
test's time limit to 1h to make sure that it has enough time to process
such a large file.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-19 14:04:27 +01:00
Ondrej Mosnacek
e38ed68c9f kernel/synflood: refactor main test condition
It turns out there is too much variability in the percent values across
arches/machines, so give up on the general approach (checking that all
SELinux functions are below some hard limit) and instead focus only on
selinux_peerlbl_enabled() and compare its position with other functions.

In case selinux_peerlbl_enabled() is not found in /proc/kallsyms, it is
inlined into other functions, so we need to check selinux_ip_postroute()
instead of selinux_peerlbl_enabled().

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-19 14:04:27 +01:00
Ondrej Mosnacek
7ee186fe44 kernel/synflood: compress perf.data before uploading
The file can get really huge and it compresses well, so it's better to
compress it with xz before doing rlFileSubmit.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-19 13:20:40 +01:00
Ondrej Mosnacek
513ab703c5 kernel/synflood: raise maximum test duration
The generated perf.data can be quite big and uploading it takes a long
time in some cases, so raise the time to 20 minutes.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-14 10:29:44 +01:00
Ondrej Mosnacek
a6425dda5c kernel/synflood: add HW requirements to metadata
Needed to schedule correctly via bkr workflow-tomorrow.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-14 10:29:14 +01:00
Ondrej Mosnacek
419529ad63 Add test for TCP synflood performance
Verify that SELinux functions do not take up more time during a TCP SYN
flood than expected.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-01-13 18:05:48 +01:00
Ondrej Mosnacek
596ec7fafe Make all relevancy expressions use comparison operators
Rather than enumerating RHEL versions, use comparison against
"known-good" version to make the expressions easier to read and
understand.

Also convert users of '~<' to '<', as '~<' compares only minor versions
within the same major.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-12-15 12:38:32 +01:00
Milos Malik
15f6d6c612 update test relevancy based on packages availability
Relevancy changes are made based on recommendations from:
  tmt test lint --fix

Some packages are available for Fedoras only and are not available
for RHELs at all.
Some packages are available for latest RHEL major versions only.
2020-12-15 11:53:28 +01:00
Ondrej Mosnacek
f7449e5226 kernel: Add test for netlabel failure to remove all rules
Add coverage for:
https://bugzilla.redhat.com/show_bug.cgi?id=1901174

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-11-26 11:40:43 +01:00
Ondrej Mosnacek
8c8e512138 selinux-testsuite: Bump to latest upstream commit
The main highlight is that filesystems tests are now run for all
supported filesystems, instead of just the one that is native to the
platform.

Also, the testsuite no longer (directly) requires Python, so drop the
dependency and a related workaround.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-11-09 16:49:29 +01:00
Ondrej Mosnacek
d21eff5cb6 selinux-testsuite: Add workarounds for missing stuff in RHEL-8.1-
Fix compilation of SCTP test programs and disable SCTP ASCONF tests on
RHEL-8.1 kernels that don't have certain SCTP commits from upstream.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-10-30 16:41:57 +01:00
Ondrej Mosnacek
8f418f8a19 selinux-testsuite: Move RHEL-specific hacks under one conditional
Put all the RHEL-specific checks/workarounds under one common rlIsRHEL
conditional to make it clear that they apply to RHEL.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-10-30 16:39:57 +01:00
Ondrej Mosnacek
8a37d00bb5 kernel/selinux-testsuite: Apply patch to fix RHEL-7 compatibility
In the last upstream ref bump, I failed to notice that one of the new
commits causes the test to fail on RHEL-7 because of a missing interface
in the policy. Temporarily apply the patch I sent upstream to fix it.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-10-29 12:36:24 +01:00
Ondrej Mosnacek
09d35a1f29 kernel/selinux-testsuite: Bump upstream ref
Highlights:
 - SCTP tests have been refactored and extended
 - the "keys" subtest has been fixed to not fail when Intel QAT driver
   is used for DH acceleration
 - the GRE interface for a second IP address is now created
   automatically by the testsuite

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-10-23 20:13:17 +02:00
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