Skip to content

Clean up testsuite policy and support running as sysadm_t

Ondrej Mosnacek selinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest22 of 24 patches 14 repliesIn review

22 of 24 patches are in this archive. The cover letter announces 24.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/24keys: change test_newcon_key_t to be just an object contextpolicy/test_keys.te tests/keys/test+1 -50 replies
2/24test_global.te: remove unused role requirepolicy/test_global.te+0 -10 replies
3/24test_global.te: don't add domains to system_rpolicy/test_global.te+1 -30 replies
6/24test_policy.if: remove weird rule from testsuite_domain_type_minimal()policy/test_policy.if+1 -20 replies
7/24policy: move unconfined_t-related dontaudit rule to where it fits betterpolicy/test_global.te policy/test_policy.if+3 -20 replies
8/24policy: move userdom_sysadm_entry_spec_domtrans_to() to general policypolicy/test_atsecure.te policy/test_binder.te policy/test_binder_bpf.te +45 more+3 -514 replies
9/24policy: move miscfiles_domain_entry_test_files() to general policypolicy/test_binder.te policy/test_binder_bpf.te policy/test_bounds.te +44 more+3 -1521 reply
10/24policy: substitute userdom_sysadm_entry_spec_domtrans_to()policy/test_global.te policy/test_policy.if+1 -140 replies
11/24test_general.te: move sysadm-related rules into an optional blockpolicy/test_global.te+14 -122 replies
12/24test_filesystem.te: remove redundant dontaudit rulespolicy/test_filesystem.te policy/test_filesystem_name_trans.te+1 -50 replies
13/24test_filesystem.te: remove suspicious rulespolicy/test_filesystem.te+0 -60 replies
14/24tests/nnp_nosuid: avoid hardcoding unconfined_t in the policypolicy/test_nnp_nosuid.te tests/nnp_nosuid/test+43 -280 replies
15/24tests/*filesystem: remove weird uses of unconfined_tpolicy/test_filesystem.te tests/filesystem/test tests/fs_filesystem/test +1 more+8 -120 replies
16/24policy: remove last hardcoded references to unconfined_tpolicy/test_global.te policy/test_inet_socket.te policy/test_policy.if +1 more+43 -70 replies
17/24test_general.te: generalize the dontaudit rulepolicy/test_global.te+3 -20 replies
18/24policy: don't audit testsuite programs searching the caller's keyspolicy/test_global.te+3 -00 replies
19/24ci: check for unconfined_t AVCs.github/workflows/checks.yml+2 -00 replies
20/24tests/binder: check only the type part of the contexttests/binder/binder_common.h tests/binder/service_provider.c tests/binder/test+21 -130 replies
21/24tests/overlay: don't hard-code SELinux user of the callertests/overlay/setup-overlay tests/overlay/test+17 -192 replies
22/24policy: give sysadm_t perms needed to run quotacheck(8)policy/test_global.te+4 -00 replies
23/24tests/vsock_socket: use modprobe to check vsock availabilitytests/vsock_socket/.gitignore tests/vsock_socket/Makefile tests/vsock_socket/check_vsock.c +1 more+4 -570 replies
24/24ci: add sysadm_t to the test matrix.github/workflows/checks.yml Vagrantfile+19 -12 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH testsuite 00/24] Clean up testsuite policy and support running as sysadm_t

This series aim for two things:
1. Refactor the policy so that it is easier to work with.
2. Leverage the refactoring to fully support running the testsuite as sysadm_u:sysadm_r:sysadm_t.

The gist of this work lies in unifying how test domains are defined, deduplicating the various boilerplate spread out all across the individual files (and not even used consistently), and in abstracting the policy caller domain/role away from the individual test policies into test_general.te. Some tests also had to be massaged to not hard-code unconfined_* and be generic against the context of the testsuite caller.

The series also extends the CI to test running the testsuite as sysadm_* and also verify that no unconfined_t/sysadm_t unexpected denials are produced (which would usually indicate a missing dontaudit rule in the testsuite policy).

Ondrej Mosnacek (24):
keys: change test_newcon_key_t to be just an object context test_global.te: remove unused role require
test_global.te: don't add domains to system_r
policy: refactor declaring test domains
policy: get rid of unconfined_runs_test()
test_policy.if: remove weird rule from testsuite_domain_type_minimal()
policy: move unconfined_t-related dontaudit rule to where it fits
better
policy: move userdom_sysadm_entry_spec_domtrans_to() to general policy
policy: move miscfiles_domain_entry_test_files() to general policy
policy: substitute userdom_sysadm_entry_spec_domtrans_to() test_general.te: move sysadm-related rules into an optional block test_filesystem.te: remove redundant dontaudit rules test_filesystem.te: remove suspicious rules tests/nnp_nosuid: avoid hardcoding unconfined_t in the policy tests/*filesystem: remove weird uses of unconfined_t
policy: remove last hardcoded references to unconfined_t test_general.te: generalize the dontaudit rule
policy: don't audit testsuite programs searching the caller's keys
ci: check for unconfined_t AVCs
tests/binder: check only the type part of the context tests/overlay: don't hard-code SELinux user of the caller
policy: give sysadm_t perms needed to run quotacheck(8) tests/vsock_socket: use modprobe to check vsock availability
ci: add sysadm_t to the test matrix

 .github/workflows/checks.yml         |   4 +
 Vagrantfile                          |  16 +++
 policy/test_atsecure.te              |  15 +--
 policy/test_attrib.te                |   1 -
 policy/test_binder.te                |  38 ++-----
 policy/test_binder_bpf.te            |  22 +---
 policy/test_bounds.te                |  11 +-
 policy/test_bpf.te                   |  30 +----
 policy/test_cap_userns.te            |   9 +-
 policy/test_capable_file.te          |  18 +--
 policy/test_capable_net.te           |   8 +-
 policy/test_capable_sys.te           |   8 +-
 policy/test_dyntrace.te              |  14 +--
 policy/test_dyntrans.te              |  17 +--
 policy/test_entrypoint.te            |   5 +-
 policy/test_execshare.te             |  16 +--
 policy/test_exectrace.te             |  16 +--
 policy/test_execute_no_trans.te      |   5 +-
 policy/test_extended_socket_class.te |  12 +-
 policy/test_fdreceive.te             |  16 +--
 policy/test_fdreceive_bpf.te         |  16 +--
 policy/test_file.te                  |  16 +--
 policy/test_filesystem.te            |  99 ++++-------------
 policy/test_filesystem_name_trans.te |   4 +-
 policy/test_filesystem_notify.te     |  12 +-
 policy/test_global.te                | 157 ++++++++++++++++++---------
 policy/test_ibendport.te             |   8 +-
 policy/test_ibpkey.te                |   8 +-
 policy/test_inet_socket.te           |  44 ++------
 policy/test_inherit.te               |  20 +---
 policy/test_ioctl.te                 |  10 +-
 policy/test_ioctl_xperms.te          |   8 +-
 policy/test_ipc.te                   |  18 +--
 policy/test_key_socket.te            |  26 +----
 policy/test_keys.te                  | 104 ++++--------------
 policy/test_link.te                  |  24 +---
 policy/test_mac_admin.te             |   9 +-
 policy/test_mkdir.te                 |  20 +---
 policy/test_mmap.te                  |  79 ++++----------
 policy/test_module_load.te           |  47 ++------
 policy/test_mqueue.te                |  16 +--
 policy/test_netlink_socket.te        |  12 +-
 policy/test_nnp_nosuid.te            |  46 ++++----
 policy/test_notify.te                |  35 ++----
 policy/test_open.te                  |  16 +--
 policy/test_overlayfs.te             |  15 +--
 policy/test_perf_event.te            |  38 ++-----
 policy/test_policy.if                |  71 ++++++------
 policy/test_prlimit.te               |  20 +---
 policy/test_ptrace.te                |  17 +--
 policy/test_readlink.te              |   8 +-
 policy/test_relabel.te               |  12 +-
 policy/test_rename.te                |  32 ++----
 policy/test_rxdir.te                 |   8 +-
 policy/test_sctp.te                  |  52 ++-------
 policy/test_setattr.te               |   8 +-
 policy/test_setnice.te               |  13 +--
 policy/test_sigkill.te               |  22 +---
 policy/test_stat.te                  |   8 +-
 policy/test_sysctl.te                |   8 +-
 policy/test_task_create.te           |  38 +------
 policy/test_task_getpgid.te          |  16 +--
 policy/test_task_getsched.te         |  16 +--
 policy/test_task_getsid.te           |  16 +--
 policy/test_task_setpgid.te          |  34 +-----
 policy/test_task_setsched.te         |  16 +--
 policy/test_transition.te            |  15 +--
 policy/test_tun_tap.te               |  34 ++----
 policy/test_unix_socket.te           |  20 +---
 policy/test_userfaultfd.te           |   8 +-
 policy/test_vsock_socket.te          |  12 +-
 policy/test_watchkey.te              |  14 +--
 tests/binder/binder_common.h         |   1 +
 tests/binder/service_provider.c      |  31 ++++--
 tests/binder/test                    |   2 +-
 tests/filesystem/test                |   4 +-
 tests/fs_filesystem/test             |   4 +-
 tests/keys/test                      |   2 +-
 tests/nfs_filesystem/test            |   4 +-
 tests/nnp_nosuid/test                |  45 +++++---
 tests/overlay/setup-overlay          |   2 +-
 tests/overlay/test                   |  34 +++---
 tests/vsock_socket/.gitignore        |   1 -
 tests/vsock_socket/Makefile          |   2 +-
 tests/vsock_socket/check_vsock.c     |  47 --------
 tests/vsock_socket/test              |  11 +-
 86 files changed, 550 insertions(+), 1346 deletions(-)
 delete mode 100644 tests/vsock_socket/check_vsock.c
Signature · 1 line
2.37.1