public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if stalld works with the queue_track backend
@ 2026-09-11 13:21 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:21 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : ed49590c4338fccbbe9e996078ecec7abed6550f
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2024-08-02T16:04:27+00:00
            Stats  : +26/-2 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/ed49590c4338fccbbe9e996078ecec7abed6550f?branch=pr775-checkpolicy-revdeps

            Log:
            test if stalld works with the queue_track backend

Recent changes (BPF code that is involved in the queue_track
backend) in the stalld component trigger SELinux denials because
SELinux policy does not expect such a behavior. The TC reproduces
the situation.

In order to support this new feature, I believe that SELinux policy
should allow the necessary actions. The TC looks for appropriate
policy rules and file context patterns.

The TC covers RHEL-50356.

---
diff --git a/selinux-policy/stalld-and-similar/Makefile b/selinux-policy/stalld-and-similar/Makefile
index 507e472..ac07019 100644
--- a/selinux-policy/stalld-and-similar/Makefile
+++ b/selinux-policy/stalld-and-similar/Makefile
@@ -55,7 +55,7 @@ $(METADATA): Makefile
 	@echo "TestTime:        10m" >> $(METADATA)
 	@echo "RunFor:          selinux-policy" >> $(METADATA)
 	@echo "RunFor:          stalld" >> $(METADATA)
-	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console stalld /usr/sbin/service" >> $(METADATA)
+	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console stalld /usr/sbin/service binutils" >> $(METADATA)
 	@echo "RhtsRequires:    library(selinux-policy/common)" >> $(METADATA)
 	@echo "Environment:     AVC_ERROR=+no_avc_check" >> $(METADATA)
 	@echo "Priority:        Normal" >> $(METADATA)
@@ -69,6 +69,7 @@ $(METADATA): Makefile
 	@echo "Bug:             2102224" >> $(METADATA) # RHEL-9
 	@echo "Bug:             2105038" >> $(METADATA) # RHEL-9
 	@echo "Bug:             2140673" >> $(METADATA) # RHEL-9
+	@echo "Bug:             RHEL-50356" >> $(METADATA) # RHEL-10
 
 	rhts-lint $(METADATA)
 

diff --git a/selinux-policy/stalld-and-similar/main.fmf b/selinux-policy/stalld-and-similar/main.fmf
index 9412a54..8f566d3 100644
--- a/selinux-policy/stalld-and-similar/main.fmf
+++ b/selinux-policy/stalld-and-similar/main.fmf
@@ -17,6 +17,7 @@ recommend:
   - setools-console
   - stalld
   - /usr/sbin/service
+  - binutils
 environment:
     AVC_ERROR: +no_avc_check
 duration: 10m
@@ -40,6 +41,7 @@ link:
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2102224
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2105038
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2140673
+  - verifies: https://issues.redhat.com/browse/RHEL-50356
 adjust:
   - enabled: false
     when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8, centos-stream-8

diff --git a/selinux-policy/stalld-and-similar/runtest.sh b/selinux-policy/stalld-and-similar/runtest.sh
index e0d7696..95e02ce 100755
--- a/selinux-policy/stalld-and-similar/runtest.sh
+++ b/selinux-policy/stalld-and-similar/runtest.sh
@@ -38,7 +38,7 @@ PROCESS_NAME="stalld"
 PROCESS_CONTEXT="stalld_t"
 
 rlJournalStart
-    if ! rpm -q ${SERVICE_PACKAGE} ; then
+    if ! rpm -q ${SERVICE_PACKAGE} >& /dev/null ; then
         rlLog "Required packages are not available/installed."
         rlJournalEnd
         exit 0
@@ -96,6 +96,27 @@ rlJournalStart
         rlSESearchRule "allow stalld_t security_t : file { getattr open read } [ ]"
     rlPhaseEnd
 
+    if strings `which stalld` | grep -q queue_track ; then
+    # if the program recognizes the queue_track option then test it and use it
+    rlPhaseStartTest "RHEL-50356"
+         rlSEMatchPathCon "/sys/fs/bpf" "bpf_t"
+         rlSESearchRule "allow stalld_t stalld_t : capability { sys_resource } [ ]"
+         rlSESearchRule "allow stalld_t stalld_t : process { setrlimit } [ ]"
+         rlSESearchRule "allow stalld_t bpf_t : dir { getattr open read } [ ]"
+         rlSESearchRule "allow stalld_t stalld_t : capability2 { bpf perfmon } [ ]"
+         rlSESearchRule "allow stalld_t stalld_t : bpf { prog_run prog_load map_read map_write map_create } [ ]"
+    rlPhaseEnd
+
+    rlPhaseStartTest "real scenario -- RHEL-50356"
+        rlRun "grep ^AGGR= /etc/sysconfig/stalld"
+        rlRun "sed -i 's/^AGGR=.*$/AGGR=\"--backend queue_track\"/' /etc/sysconfig/stalld"
+        rlRun "grep ^AGGR= /etc/sysconfig/stalld"
+        rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status stop status" 5
+        rlRun "sed -i 's/^AGGR=.*$/AGGR=/' /etc/sysconfig/stalld"
+        rlRun "grep ^AGGR= /etc/sysconfig/stalld"
+    rlPhaseEnd
+    fi
+
     rlPhaseStartTest "real scenario -- standalone service"
         if ! rlSEDefined ${PROCESS_CONTEXT} ; then
             PROCESS_CONTEXT="unconfined_service_t"

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 13:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 13:21 [tests/selinux] pr775-checkpolicy-revdeps: test if stalld works with the queue_track backend Milos Malik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox