public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] main: add a new basic test which covers the qat service
@ 2026-08-05 7:38 Milos Malik
0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-08-05 7:38 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : tests/selinux
Branch : main
Commit : e5badb50c67376aa32c227fbeee67e00e9202c42
Author : Milos Malik <mmalik@redhat.com>
Date : 2026-07-24T14:44:41+02:00
Stats : +137/-0 in 2 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/e5badb50c67376aa32c227fbeee67e00e9202c42?branch=main
Log:
add a new basic test which covers the qat service
Recently filed bug reports revealed that SELinux prevents the qat_init.sh
process from the following actions:
* accessing (syscall = newfstatat) the /dev/hugepages directory
* creating (syscall = mkdir) the /dev/hugepages/qat directory
* setting permissions/ownership (syscall = fchownat)
The TC reproduces the situation.
In order to support the qat service functionality, I believe that
SELinux policy should allow these actions. The TC looks for appropriate
policy rules and file context patterns.
The TC covers RHEL-211077 and RHEL-211089.
---
diff --git a/selinux-policy/qat-service-and-similar/main.fmf b/selinux-policy/qat-service-and-similar/main.fmf
new file mode 100644
index 0000000..0accdbb
--- /dev/null
+++ b/selinux-policy/qat-service-and-similar/main.fmf
@@ -0,0 +1,49 @@
+summary: SELinux interferes with qatlib and related programs
+description: |+
+ SELinux interferes with qatlib and related programs.
+
+contact: Milos Malik <mmalik@redhat.com>
+component:
+ - qatlib
+ - selinux-policy
+test: ./runtest.sh
+framework: beakerlib
+require:
+ - type: library
+ name: /selinux-policy/Library/common
+ nick: selinux-policy
+recommend:
+ - audit
+ - libselinux
+ - libselinux-utils
+ - policycoreutils
+ - selinux-policy
+ - selinux-policy-targeted
+ - setools-console
+ - qatlib
+ - qatlib-service
+ - /usr/sbin/service
+environment:
+ AVC_ERROR: +no_avc_check
+duration: 10m
+enabled: true
+tag:
+ - NoRHEL4
+ - NoRHEL5
+ - NoRHEL6
+ - NoRHEL7
+ - targeted
+ - NoRHIVOS
+link:
+ - verifies: https://issues.redhat.com/browse/RHEL-211077
+ - verifies: https://issues.redhat.com/browse/RHEL-211089
+adjust+:
+ - enabled: false
+ when: distro == rhel-4, rhel-5, rhel-6, rhel-7
+ because: the qatlib package is not available there
+ - enabled: false
+ when: arch == aarch64, ppc64le, s390x
+ because: the qatlib package is not available there
+extra-summary: /CoreOS/selinux-policy/Regression/qat-service-and-similar
+extra-task: /CoreOS/selinux-policy/Regression/qat-service-and-similar
+
diff --git a/selinux-policy/qat-service-and-similar/runtest.sh b/selinux-policy/qat-service-and-similar/runtest.sh
new file mode 100755
index 0000000..f52788b
--- /dev/null
+++ b/selinux-policy/qat-service-and-similar/runtest.sh
@@ -0,0 +1,88 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# runtest.sh of /CoreOS/selinux-policy/Regression/qat-service-and-similar
+# Description: SELinux interferes qatlib and related programs
+# Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2026 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, see
+# <https://www.gnu.org/licenses/>.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="selinux-policy"
+FILE_PATH="/usr/bin/qat_init.sh"
+SERVICE_NAME="qat"
+PROCESS_NAME="qat_init.sh"
+if seinfo -t | grep -q qatlib ; then
+ FILE_CONTEXT="qatlib_exec_t"
+ PROCESS_CONTEXT="qatlib_t"
+else
+ FILE_CONTEXT="bin_t"
+ PROCESS_CONTEXT="unconfined_service_t"
+fi
+
+rlJournalStart
+ rlPhaseStartSetup
+ rlRun "rlImport 'selinux-policy/common'" 0,1
+ rlAssertRpm ${PACKAGE}
+ rlAssertRpm ${PACKAGE}-targeted
+ rlRun "rpm -qf ${FILE_PATH}"
+
+ rlServiceStop ${SERVICE_NAME}
+
+ rlSESetEnforce
+ rlSEStatus
+ rlSESetTimestamp
+ sleep 2
+ rlPhaseEnd
+
+ if rlSEDefined ${PROCESS_CONTEXT} ; then
+ rlPhaseStartTest "RHEL-211077"
+ rlSEMatchPathCon ${FILE_PATH} ${FILE_CONTEXT}
+ rlSEMatchPathCon "/dev/hugepages" "hugetlbfs_t"
+ rlSESearchRule "allow qatlib_t hugetlbfs_t : dir { getattr } [ ]"
+ rlPhaseEnd
+
+ rlPhaseStartTest "RHEL-211089"
+ rlSEMatchPathCon "/dev/hugepages/qat" "hugetlbfs_t"
+ rlSESearchRule "allow qatlib_t hugetlbfs_t : dir { search create add_name write setattr } [ ]"
+ rlPhaseEnd
+ fi
+
+ if [ -f /usr/lib/systemd/system/${SERVICE_NAME}.service ] ; then
+ rlPhaseStartTest "real scenario -- standalone service"
+ rlSEService - ${SERVICE_NAME} - ${PROCESS_CONTEXT} "start status" 1
+ rlRun "restorecon -Rv /etc /run /var -e /var/ARTIFACTS" 0-255
+ rlSEService - ${SERVICE_NAME} - ${PROCESS_CONTEXT} "restart status" 1
+ rlSEService - ${SERVICE_NAME} - ${PROCESS_CONTEXT} "stop status" 1
+ rlPhaseEnd
+ fi
+
+ rlPhaseStartCleanup
+ sleep 2
+ rlSECheckAVC
+
+ rlServiceRestore ${SERVICE_NAME}
+ rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
+
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-05 7:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-05 7:38 [tests/selinux] main: add a new basic test which covers the qat service Milos Malik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox