public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Milos Malik <mmalik@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: test if power-profiles-daemon can switch between profiles
Date: Fri, 11 Sep 2026 13:23:04 GMT [thread overview]
Message-ID: <178913298401.1.16212156440709838193.tests-selinux-7093be1ae3eb@fedoraproject.org> (raw)
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
reply other threads:[~2026-09-11 13:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178913298401.1.16212156440709838193.tests-selinux-7093be1ae3eb@fedoraproject.org \
--to=mmalik@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox