public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: add the numad test to upstream repo
@ 2026-09-11 13:18 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:18 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 9be7e22519f35d64e309ead9687de80ce41ad95e
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2021-03-03T10:59:21+01:00
            Stats  : +216/-0 in 4 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/9be7e22519f35d64e309ead9687de80ce41ad95e?branch=pr775-checkpolicy-revdeps

            Log:
            add the numad test to upstream repo

The numad component is used in various versions of RHEL and Fedora,
so it makes sense to run this TC in upstream testing too.
Moving the downstream TC to upstream repository.
There are some minor changes when comparing the upstream and downstream
versions of the TC.

---
diff --git a/selinux-policy/numad-and-similar/Makefile b/selinux-policy/numad-and-similar/Makefile
new file mode 100644
index 0000000..cff1beb
--- /dev/null
+++ b/selinux-policy/numad-and-similar/Makefile
@@ -0,0 +1,84 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Makefile of /CoreOS/selinux-policy/Regression/numad-and-similar
+#   Description: SELinux interferes with numad and related programs
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2021 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/selinux-policy/Regression/numad-and-similar
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile PURPOSE
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+	./runtest.sh
+
+build: $(BUILT_FILES)
+	chmod a+x runtest.sh
+	chcon -t bin_t runtest.sh
+
+clean:
+	rm -f *~ $(BUILT_FILES)
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+	@echo "Owner:           Milos Malik <mmalik@redhat.com>" > $(METADATA)
+	@echo "Name:            $(TEST)" >> $(METADATA)
+	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
+	@echo "Path:            $(TEST_DIR)" >> $(METADATA)
+	@echo "Description:     SELinux interferes with numad and related programs" >> $(METADATA)
+	@echo "Type:            Regression" >> $(METADATA)
+	@echo "TestTime:        10m" >> $(METADATA)
+	@echo "RunFor:          selinux-policy" >> $(METADATA)
+	@echo "RunFor:          numad" >> $(METADATA)
+	@echo "Requires:        audit" >> $(METADATA)
+	@echo "Requires:        expect" >> $(METADATA)
+	@echo "Requires:        grep" >> $(METADATA)
+	@echo "Requires:        initscripts" >> $(METADATA)
+	@echo "Requires:        libselinux" >> $(METADATA)
+	@echo "Requires:        libselinux-utils" >> $(METADATA)
+	@echo "Requires:        numad" >> $(METADATA)
+	@echo "Requires:        policycoreutils" >> $(METADATA)
+	@echo "Requires:        procps" >> $(METADATA)
+	@echo "Requires:        selinux-policy" >> $(METADATA)
+	@echo "Requires:        setools" >> $(METADATA)
+	@echo "Requires:        setools-console" >> $(METADATA)
+	@echo "RhtsRequires:    library(selinux-policy/common)" >> $(METADATA)
+	@echo "Priority:        Normal" >> $(METADATA)
+	@echo "License:         GPLv2" >> $(METADATA)
+	@echo "Confidential:    no" >> $(METADATA)
+	@echo "Destructive:     no" >> $(METADATA)
+	@echo "Environment:     AVC_ERROR=+no_avc_check" >> $(METADATA)
+	@echo "Architectures:   i386 ppc64 x86_64" >> $(METADATA)
+	@echo "Releases:        -RHEL4 -RHELServer5 -RHELClient5" >> $(METADATA)
+	@echo "Bug:             807157" >> $(METADATA) # RHEL-6
+	@echo "Bug:             857086" >> $(METADATA) # RHEL-7
+	@echo "Bug:             1074449" >> $(METADATA) # RHEL-7
+	@echo "Bug:             1118515" >> $(METADATA) # RHEL-7
+
+	rhts-lint $(METADATA)
+

diff --git a/selinux-policy/numad-and-similar/PURPOSE b/selinux-policy/numad-and-similar/PURPOSE
new file mode 100644
index 0000000..e3fd202
--- /dev/null
+++ b/selinux-policy/numad-and-similar/PURPOSE
@@ -0,0 +1,5 @@
+PURPOSE of /CoreOS/selinux-policy/Regression/numad-and-similar
+Author: Milos Malik <mmalik@redhat.com>
+
+SELinux interferes with numad and related programs.
+

diff --git a/selinux-policy/numad-and-similar/main.fmf b/selinux-policy/numad-and-similar/main.fmf
new file mode 100644
index 0000000..e1d0e95
--- /dev/null
+++ b/selinux-policy/numad-and-similar/main.fmf
@@ -0,0 +1,2 @@
+path: /selinux-policy/numad-and-similar
+tier: 2

diff --git a/selinux-policy/numad-and-similar/runtest.sh b/selinux-policy/numad-and-similar/runtest.sh
new file mode 100644
index 0000000..0c639ef
--- /dev/null
+++ b/selinux-policy/numad-and-similar/runtest.sh
@@ -0,0 +1,125 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/selinux-policy/Regression/numad-and-similar
+#   Description: SELinux interferes with numad and related programs
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2021 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include rhts environment
+. /usr/bin/rhts-environment.sh
+. /usr/share/beakerlib/beakerlib.sh
+
+PACKAGE="selinux-policy"
+ROOT_PASSWORD="redhat"
+SERVICE_NAME="numad"
+PROCESS_NAME="numad"
+PROCESS_CONTEXT="numad_t"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "rlImport 'selinux-policy/common'"
+        rlSESatisfyRequires
+        rlAssertRpm ${PACKAGE}
+        rlAssertRpm ${PACKAGE}-targeted
+        rlAssertRpm numad
+
+        rlServiceStop ${SERVICE_NAME}
+        rlFileBackup /etc/shadow
+
+        rlSESetEnforce
+        rlSEStatus
+        rlSESetTimestamp
+        sleep 2
+    rlPhaseEnd
+
+    if rlSEDefined "numad_t numad_exec_t" ; then
+    rlPhaseStartTest "bz#807157"
+        rlSEMatchPathCon "/usr/bin/numad" "numad_exec_t"
+        rlSESearchRule "allow initrc_t numad_t : process { transition }"
+    rlPhaseEnd
+    fi
+
+    if rlSEDefined "numad_exec_t cgroup_t numad_t" ; then
+    rlPhaseStartTest "bz#857086"
+        rlSEMatchPathCon "/usr/bin/numad" "numad_exec_t"
+        if rlIsRHEL 6 ; then
+            MOUNT_POINT="/cgroup/cpuset"
+            rlSEMatchPathCon "${MOUNT_POINT}" "cgroup_t"
+        else
+            MOUNT_POINT="/sys/fs/cgroup/cpuset"
+            if [ -d ${MOUNT_POINT} ] ; then
+                rlRun "ls -dZ ${MOUNT_POINT} | grep :cgroup_t"
+            else
+                rlSEMatchPathCon "/sys/fs/cgroup" "cgroup_t"
+            fi
+        fi
+        rlSESearchRule "allow numad_t cgroup_t : dir { getattr search }"
+        rlSESearchRule "allow numad_t numad_t : msg { send receive }"
+    rlPhaseEnd
+    fi
+
+    if ! rlIsRHEL 5 6 ; then
+    rlPhaseStartTest "bz#1074449"
+        rlSEMatchPathCon "/usr/bin/numad" "numad_exec_t"
+        rlSESearchRule "allow numad_t sysfs_t : file { write }"
+    rlPhaseEnd
+
+    rlPhaseStartTest "bz#1118515"
+        rlSEMatchPathCon "/usr/bin/numad" "numad_exec_t"
+        rlSEMatchPathCon "/var/log/numad.log" "numad_var_log_t"
+        rlSEMatchPathCon "/var/run/numad.pid" "numad_var_run_t"
+        rlSESearchRule "allow virtd_t numad_exec_t : file { getattr open read execute }"
+        rlSESearchRule "type_transition virtd_t numad_exec_t : process numad_t"
+        rlSESearchRule "allow virtd_t numad_t : process { transition }"
+        rlSESearchRule "allow numad_t numad_var_log_t : file { open }"
+        rlSESearchRule "allow numad_t numad_t : msg { send receive }"
+        rlSESearchRule "allow numad_t numad_t : msgq { associate unix_read unix_write read write }"
+        rlSESearchRule "allow numad_t numad_var_run_t : file { getattr open read }"
+    rlPhaseEnd
+    fi
+
+    rlPhaseStartTest "real scenario"
+        rlRun "mkdir -p ${MOUNT_POINT}"
+        if ! mount | grep -q "cgroup.*cpuset" ; then
+            rlRun "mount cgroup -t cgroup -o cpuset ${MOUNT_POINT}" 0,32
+        fi
+        rlRun "semodule -l | grep numad"
+        rlRun "echo ${ROOT_PASSWORD} | passwd --stdin root"
+        rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status" 1
+        rlRun "numad -S 0"
+        rlRun "numad -S 1"
+        rlRun "restorecon -Rv /run /var"
+        rlSEService ${ROOT_PASSWORD} ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "restart status stop status" 1
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        sleep 2
+        rlSECheckAVC
+        rlFileRestore
+
+        rlServiceRestore ${SERVICE_NAME}
+    rlPhaseEnd
+    rlJournalPrintText
+rlJournalEnd
+

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

only message in thread, other threads:[~2026-09-11 13:18 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:18 [tests/selinux] pr775-checkpolicy-revdeps: add the numad test to upstream repo Milos Malik

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