public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if power-profiles-daemon can switch between profiles
@ 2026-09-11 13:23 Milos Malik
0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:23 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 7093be1ae3eb295ea60e6c3f72fb66bc32bcb423
Author : Milos Malik <mmalik@redhat.com>
Date : 2025-07-25T14:39:46+00:00
Stats : +21/-1 in 3 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/7093be1ae3eb295ea60e6c3f72fb66bc32bcb423?branch=pr775-checkpolicy-revdeps
Log:
test if power-profiles-daemon can switch between profiles
A recently reported bug revealed that SELinux prevents the
power-profiles-daemon processes from writing to the following file:
* /sys/devices/system/cpu/cpufreq/policy6/energy_performance_preference
The TC does not reproduce the situation usually.
In order to support the intentional behavior of the daemon when
power cable gets unplugged/plugged, I believe that SELinux policy
should allow the action. The TC looks for appropriate policy rules
and file context patterns.
The TC covers RHEL-100718.
---
diff --git a/selinux-policy/power-profiles-daemon-and-similar/Makefile b/selinux-policy/power-profiles-daemon-and-similar/Makefile
index afd0a0a..e69ab07 100644
--- a/selinux-policy/power-profiles-daemon-and-similar/Makefile
+++ b/selinux-policy/power-profiles-daemon-and-similar/Makefile
@@ -65,6 +65,7 @@ $(METADATA): Makefile
@echo "Releases: -RHEL4 -RHEL5 -RHEL6 -RHEL7 -RHEL8" >> $(METADATA)
@echo "Bug: RHEL-61117" >> $(METADATA) # RHEL-9
@echo "Bug: RHEL-62356" >> $(METADATA) # RHEL-10
+ @echo "Bug: RHEL-100718" >> $(METADATA) # RHEL-9
rhts-lint $(METADATA)
diff --git a/selinux-policy/power-profiles-daemon-and-similar/main.fmf b/selinux-policy/power-profiles-daemon-and-similar/main.fmf
index f46c363..bb99a94 100644
--- a/selinux-policy/power-profiles-daemon-and-similar/main.fmf
+++ b/selinux-policy/power-profiles-daemon-and-similar/main.fmf
@@ -33,6 +33,7 @@ tag:
link:
- verifies: https://issues.redhat.com/browse/RHEL-61117
- verifies: https://issues.redhat.com/browse/RHEL-62356
+ - verifies: https://issues.redhat.com/browse/RHEL-100718
adjust:
- enabled: false
when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8, rhel-10, centos-stream-10
diff --git a/selinux-policy/power-profiles-daemon-and-similar/runtest.sh b/selinux-policy/power-profiles-daemon-and-similar/runtest.sh
index fef6400..d2bd088 100755
--- a/selinux-policy/power-profiles-daemon-and-similar/runtest.sh
+++ b/selinux-policy/power-profiles-daemon-and-similar/runtest.sh
@@ -74,6 +74,16 @@ rlJournalStart
rlPhaseEnd
fi
+ rlPhaseStartTest "RHEL-100718"
+ if [ -d /sys/devices/system/cpu/cpufreq ] ; then
+ for CUR_FILE in `find /sys/devices/system/cpu/cpufreq -type f -name energy_performance_preference` ; do
+ CUR_TYPE=`secon --type --file ${CUR_FILE}`
+ rlSESearchRule "allow powerprofiles_t $CUR_TYPE : file { write } [ ]"
+ done
+ fi
+ rlSESearchRule "allow powerprofiles_t fs_t : filesystem { getattr } [ ]"
+ rlPhaseEnd
+
if [ -f /usr/lib/systemd/system/${SERVICE_NAME}.service ] ; then
rlPhaseStartTest "real scenario -- standalone service"
rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status" 1
@@ -82,8 +92,16 @@ rlJournalStart
rlRun "powerprofilesctl version"
rlRun "restorecon -Rv /etc /run /var -e /var/ARTIFACTS" 0-255
rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "restart status" 1
+ ORIG_PROFILE=`powerprofilesctl get`
+ if echo ${ORIG_PROFILE} | grep -q balanced ; then
+ rlRun "powerprofilesctl set power-saver" 0,1
+ else
+ rlRun "powerprofilesctl set balanced" 0,1
+ fi
+ sleep 2
rlRun "powerprofilesctl get"
- rlRun "powerprofilesctl set balanced" 0,1
+ rlRun "powerprofilesctl set ${ORIG_PROFILE}"
+ sleep 2
rlRun "powerprofilesctl launch echo" 0,1
rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "stop status" 1
rlPhaseEnd
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 13:23 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:23 [tests/selinux] pr775-checkpolicy-revdeps: test if power-profiles-daemon can switch between profiles Milos Malik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox