Commit graph

108 commits

Author SHA1 Message Date
Ondrej Mosnacek
96c98bb01d
kernel/selinux-testsuite: bump upstream commit
Effective changes:
- fix the policy to allow the new user_namespace::create permission
  where needed
- fix the code to build without warnings with latest SELinux userspace

The rest is various cleanups or changes not affecting Fedora/RHEL.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-12-12 16:19:39 +01:00
Ondrej Mosnacek
269502e64d
kernel/labeling_before_...: use --regenerate-all also during cleanup
Otheriwse older kernel entries would still have our injected scripts in
the initramfs after test execution.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-09-15 15:20:55 +02:00
Ondrej Mosnacek
ef2646911d
Port kernel tests from downstream
Forward-port of downstream kernel tests that haven't been upstreamed
yet, manually converted to TMT.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-09-13 14:24:47 +02:00
Ondrej Mosnacek
25176f01ce
kernel/genfs_fallback: use vfat instead of ramfs
ramfs is now treated as an xattr-supporting filesystem and has the
fs_use_trans directive in the base policy. Thus switch to vfat, which is
still genfs.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-09-13 11:06:41 +02:00
Ondrej Mosnacek
03bf3a0e70
kernel/selinux-testsuite: fail hard when PR/patch application fails
Replace the current soft fallback to raw GIT_BRANCH when a required PR
or Patchwork patch fails to merge/apply with a hoard failure, similar to
what we do when cloning the repo fails.

The main motivation is to not have CKI treat this situation as a
failure, but it also a good practice to ensure we either run the
intended version of the test or no test at all.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-08-31 10:23:41 +02:00
Ondrej Mosnacek
21a2855558
kernel/selinux-testsuite: bump upstream commit to c592d7f
Effective changes:
* fix for https://gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/issues/1352
* major testsuite policy refactoring
* various minor fixes/tweaks

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-08-30 20:18:33 +02:00
Ondrej Mosnacek
de353795c2
kernel/selinux-testsuite: use correct linker to build kernel modules
Start applying a testsite patch that fixes kernel module build for
kernels built with clang + with LTO enabled.

Fixes: https://gitlab.com/redhat/centos-stream/tests/kernel/kernel-tests/-/issues/1272
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-07-18 13:25:02 +02:00
Ondrej Mosnacek
66bf874bec kernel/selinux-testsuite: bump upstream commit
The only effective difference is that the broken SCTP ASCONF tests will
now be skipped, see:
3e93ece73d

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-06-08 09:27:31 +00:00
Ondrej Mosnacek
fd520ce6f3
Add a test for bogus warning in selinux_ima_measure_state()
Verifies:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ce2fc710c9d2b25afc710f49bb2065b4439a62bc

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-05-10 15:31:19 +02:00
Ondrej Mosnacek
c1d19b8516
kernel/selinux-testsuite: disable Beaker AVC check
Add AVC_ERROR=+no_avc_check into test environment to disable Beaker's
AVC check, as this test produces s lot of expected AVC denials.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-04-27 15:38:12 +02:00
Ondrej Mosnacek
46081dbdf1
kernel/synflood: disable the test due to being unreliable
The test doesn't detect the presence of the performance issue reliably
across machines and architectures, so disable it for now.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-04-27 14:42:52 +02:00
Ondrej Mosnacek
94b4e53487
kernel/selinux-testsuite: apply an urgent fix to the ioctl test
The ioctl number is not consistent across arches. The fix adds the
numbers for other arches to make the test work on all arches again.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-04-21 11:21:10 +02:00
Ondrej Mosnacek
120532d05e
kernel/selinux-testsuite: always run in /root
Running in paths containing ':' or in /tmp doesn't work, so make sure
that the testsuite is run in /root.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-04-20 17:07:44 +02:00
Ondrej Mosnacek
fff6691dcd
kernel/selinux-testsuite: bump upstream commit
...and remove some workarounds that are no longer needed. Also add code
to enable/disable SCTP client peeloff tests based on where SCTP client
peeloff is currently fixed in RHEL.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-04-20 17:07:44 +02:00
Ondrej Mosnacek
003e7202d6 kernel/sctp_peer_label_bug: sleep before open_assoc
It seems none of the attempts to synchronize before connecting are good
enough - add some extra sleep time to the beginning of open_assoc().

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-02-14 23:41:18 +01:00
Ondrej Mosnacek
fab242726e kernel/sctp_peer_label_bug: timeout the server
In case of a bug/error, the server may end up hanging, so make sure it
terminates in some reasonable time.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-02-14 23:39:54 +01:00
Ondrej Mosnacek
c776c35f82 kernel/sctp_peer_label_bug: subscribe to events early (server)
This is needed to avoid a race condition.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-02-14 23:39:52 +01:00
Ondrej Mosnacek
7b6ee73ecb Add a test for two-way SCTP association setup
This test reproduces a bug that may cause an AVC with sctp_socket,
association, unlabeled_t, unlabeled_t (and also another bug related to
SCTP peeloff on the client side).

SCTP code taken and modified from selinux-testsuite's sctp subtest.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-02-13 21:14:49 +01:00
Ondrej Mosnacek
06baee37d5 Revert "Add preliminary SCTP client-side peeloff coverage"
This reverts commit 8b59d115d3.

Never mind, I realized this is not actually needed...

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-02-13 16:04:21 +01:00
Ondrej Mosnacek
8b59d115d3 Add preliminary SCTP client-side peeloff coverage
Add a variant of the selinux-testsuite test that adds a patch adding
coverage for SCTP client peeloff so that we can conveniently verify
related bugs until the fix and testsuite coverage are merged upstream.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-02-13 14:48:46 +01:00
Ondrej Mosnacek
ee424688c6 kernel/ocontext-race: disable the test on s390x
Only at most 2-CPU s390x machines are available in Beaker and the bug is
not reproducible on them, so just disable the test on s390x.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-01-24 10:22:03 +01:00
Ondrej Mosnacek
5672c531ab Add test for ocontext race condition in the kernel
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-01-14 15:20:04 +01:00
Ondrej Mosnacek
dca9d3c17e kernel/selinux-testsuite: use HTTPS git URL
Recently GitHub has deprecated the git:// protocol and cloning now fails
with this message:
```
fatal: remote error:
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
```

The only reason that git:// was being used instead of https:// was
allowing the test to run on RHEL-5, which has problems with accessing
GitHub via HTTPS due to protocol disparity. By now it should be okay to
throw RHEL-5 under the bus and use the https:// URL.

Since we are definitely making this test unable to run on RHEL-5, also
remove all RHEL-5-specific hacks from the code.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2022-01-11 11:37:54 +01:00
Ondrej Mosnacek
b0f7063a8d kernel/selinux-testsuite: bump upstream commit
Pull in a fix that allows the testsuite to succeed on kernels with
CONFIG_IP_TABLES=n (e.g. Fedora ELN kernels; future RHEL 10+ kernels).

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-10-27 13:52:48 +02:00
Ondrej Mosnacek
c1eb053801 kernel/selinux-testsuite: bump upstream ref
This pulls in the lockdown test removal, which will be needed for
successful testing of new kernels.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-10-13 11:02:27 +02:00
Ondrej Mosnacek
0f43ff1aad kernel/selinux-testsuite: bump upstream ref
This revision integrates two patch series and adds a fix for:
https://gitlab.com/cki-project/kernel-tests/-/issues/750

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-27 10:52:19 +02:00
Ondrej Mosnacek
153042bdad kernel/selinux-testsuite: guard against missing unconfined_service_t
RHEL-6 didn't have unconfined_service_t yet, so we must skip the fd::use
workaround there.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2021-09-24 12:02:53 +02:00
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