Skip to contentSkip to conversation

tmt: add setup for BPF token tests

PATCH In review Ondrej Mosnacek 2 participants 3 messages Apr 9 – May 13 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tmt: add setup for BPF token tests

Adjust the system policy such that the BPF token tests get exercised in CI or when run via tmt manually.

---
 tmt/tests.fmf | 5 +++++
 1 file changed, 5 insertions(+)
tmt/tests.fmf +5 -0
index 1df3a5d..88039f8 100644
@@ -42,8 +42,11 @@
         semodule -c -E base
         sed -i \
           -e 's/\((class system (ipc_info syslog_read syslog_mod syslog_console module_request module_load \)\(halt reboot status start stop enable disable reload undefined ))\)/\1firmware_load kexec_image_load kexec_initramfs_load policy_load x509_certificate_load \2/' \
+          -e 's/map_create/map_create map_create_as/' \
+          -e 's/prog_load/prog_load prog_load_as/' \
           base.cil
         echo "(policycap netlink_xperm)" >>base.cil
+        echo "(policycap bpf_token_perms)" >>base.cil
         # allow nlmsg to some system domains so that the system can boot
         for source in daemon initrc_domain systemprocess unconfined_domain_type sysadm_t; do
           echo "(allow $source self (netlink_route_socket (nlmsg)))" >>base.cil
@@ -55,6 +58,8 @@
         rm -f base.cil
         sed -i.orig \
           -e 's/module_load /module_load firmware_load kexec_image_load kexec_initramfs_load policy_load x509_certificate_load /' \
+          -e 's/map_create/map_create map_create_as/' \
+          -e 's/prog_load/prog_load prog_load_as/' \
           /usr/share/selinux/devel/include/support/all_perms.spt
         ;;
       local)
Signature · 1 line
2.53.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Ondrej Mosnacek

Adjust the system policy such that the BPF token tests get exercised in CI or when run via tmt manually.

Quoted 33 lines
---
 tmt/tests.fmf | 5 +++++
 1 file changed, 5 insertions(+)
tmt/tests.fmf +5 -1
index 1df3a5d..88039f8 100644
@@ -42,8 +42,11 @@
         semodule -c -E base
         sed -i \
           -e 's/\((class system (ipc_info syslog_read syslog_mod syslog_console module_request module_load \)\(halt reboot status start stop enable disable reload undefined ))\)/\1firmware_load kexec_image_load kexec_initramfs_load policy_load x509_certificate_load \2/' \
+          -e 's/map_create/map_create map_create_as/' \
+          -e 's/prog_load/prog_load prog_load_as/' \
           base.cil
         echo "(policycap netlink_xperm)" >>base.cil
+        echo "(policycap bpf_token_perms)" >>base.cil
         # allow nlmsg to some system domains so that the system can boot
         for source in daemon initrc_domain systemprocess unconfined_domain_type sysadm_t; do
           echo "(allow $source self (netlink_route_socket (nlmsg)))" >>base.cil
@@ -55,6 +58,8 @@
         rm -f base.cil
         sed -i.orig \
           -e 's/module_load /module_load firmware_load kexec_image_load kexec_initramfs_load policy_load x509_certificate_load /' \
+          -e 's/map_create/map_create map_create_as/' \
+          -e 's/prog_load/prog_load prog_load_as/' \
           /usr/share/selinux/devel/include/support/all_perms.spt
         ;;
       local)
--

2.53.0

author Applied
#2 lore raw
Quoted 9 lines · Stephen Smalley
Quoted 5 lines · Ondrej Mosnacek

Adjust the system policy such that the BPF token tests get exercised in CI or when run via tmt manually.

Thanks, applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/1aad4384207e996589bf5367f737dd4f87624b59

Signature · 3 lines
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.