Commit graph

81 commits

Author SHA1 Message Date
Ondrej Mosnacek
08dcaa3534 kernel/selinux-testsuite: patch the policy for restraint
When this test in run via restraint (e.g. on Beaker), it inherits some
file descriptors originating from it, labeled unconfined_service_t. This
leads to a huge amount of denials when test programs are exectuted.

To work around this, add a rule to the policy that allows the test
domains to inherit these descriptors from unconfined_service_t.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-22 22:41:55 +02:00
Ondrej Mosnacek
818ae3f6ba kernel/selinux-testsuite: exclude vsock_socket on RHEL kernels without required fix
Kernels before 4.18.0-314.el8 lack the bugfix that is required for this
test to pass, so exclude it on these kernels.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-08 16:22:27 +02:00
Ondrej Mosnacek
180ee684de kernel/selinux-testsuite: update vsock_socket build fix patch
On RHEL-7.2, also the vsock_socket class is missing from the policy -
update the patch to v2, which also checks for the presence of the class.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-08 13:56:22 +02:00
Ondrej Mosnacek
7a66f3c2ad kernel/selinux-testsuite: apply a patch to fix building on RHEL-7
I missed that the new vsock_socket subtest fails to build on RHEL-7.
Apply a patch that excludes it when the necessary header/definition is
not available.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-07 20:07:06 +02:00
Ondrej Mosnacek
87fa61ef9c kernel/selinux-testsuite: fix module_load test on clang-built kernels
CKI is running the testsuite also on clang-built kernels, which need the
modules to be built using clang, too. Apply pending patches from
upstream to make the testsuite work on these kernels.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-06 13:09:44 +02:00
Ondrej Mosnacek
25396ff474 kernel/selinux-testsuite: bump upstream commit
This adds a new VSOCK test and drops an already merged bugfix.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-06 13:06:46 +02:00
Ondrej Mosnacek
b96679e022 kernel/selinux-testsuite: apply patch to fix failure on BTRFS
The capable_sys test is failing on F35 without his patch, because BTRFS
doesn't support the FIBMAP ioctl.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-08-04 15:14:13 +02:00
Ondrej Mosnacek
9b9952f92c kernel/selinux-testsuite: update metadata to better match TCMS
...to allow switching the TCMS entry to refer directly here via a FMF
link. Note: I'm not adding the tags, as most of those is
RHEL/RH-specific and they can be maintained just in TCMS.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-05-27 19:03:38 +00:00
Ondrej Mosnacek
455409b672 kernel/selinux-testsuite: fix condition for skipping the keys subtest
It actually doesn't work (and doesn't get excluded automatically) on
RHEL-7 either, so change the condition to rhel < 9.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-05-06 11:17:00 +02:00
Ondrej Mosnacek
1a7541ad66 kernel/selinux-testsuite: update the XFS quota bug workaround
The bugfix has been backported in RHEL-8.4, so we can now replace this
with a kernel version check, increasing the coverage on RHEL-8.4 and
above.

Verified that the testsuite still passes on RHEL-8.3, 8.4, and RHEL-9.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-05-05 15:59:35 +02:00
Ondrej Mosnacek
3750c47bc8 kernel/selinux-testsuite: move keys test exclude under RHEL-8
The relevant config option is now enabled on RHEL-9, so we can skip it
on RHEL-8 only to get coverage on RHEL-9 and above.

Tested on latest RHEL-9 VM image.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-05-05 15:40:10 +02:00
Ondrej Mosnacek
f6ee2087e8 kernel/selinux-testsuite: Bump upstream commit
This pulls in two fixes for running on the latest v5.13 kernels.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-05-04 10:36:41 +02:00
Ondrej Mosnacek
118ffc5219 kernel/avc_tracepoint: disable restraint's AVC check
Set AVC_ERROR=+no_avc_check in environment to disable restraint's
built-in AVC check so that it doesn't interpret the (expected) AVCs as
failure.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-04-29 08:14:28 +02:00
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