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 machinectl can kill VMs running under systemd-machined
Date: Fri, 11 Sep 2026 13:22:22 GMT [thread overview]
Message-ID: <178913294218.1.1010703555260974732.tests-selinux-255c7cda9260@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 255c7cda9260db7de1018aca74599e8f8e05fb93
Author : Milos Malik <mmalik@redhat.com>
Date : 2025-02-10T10:43:16+00:00
Stats : +26/-8 in 3 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/255c7cda9260db7de1018aca74599e8f8e05fb93?branch=pr775-checkpolicy-revdeps
Log:
test if machinectl can kill VMs running under systemd-machined
Recent systemd-machined + selinux-policy testing revealed that SELinux
prevents the machinectl command (consequently the systemd-machined
process) from stopping, rebooting or powering off the VMs. The TC
reproduces the situation.
In order to support this documented 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-76352, RHEL-77087 and their duplicates.
---
diff --git a/selinux-policy/systemd-machined-and-similar/Makefile b/selinux-policy/systemd-machined-and-similar/Makefile
index d34d9a0..c9b3c59 100644
--- a/selinux-policy/systemd-machined-and-similar/Makefile
+++ b/selinux-policy/systemd-machined-and-similar/Makefile
@@ -68,6 +68,9 @@ $(METADATA): Makefile
@echo "Bug: 1900888" >> $(METADATA) # Fedora 35
@echo "Bug: RHEL-49567" >> $(METADATA) # RHEL-10
@echo "Bug: RHEL-74280" >> $(METADATA) # RHEL-10
+ @echo "Bug: RHEL-76352" >> $(METADATA) # RHEL-9
+ @echo "Bug: RHEL-77087" >> $(METADATA) # RHEL-10
+ @echo "Bug: RHEL-78088" >> $(METADATA) # RHEL-10
rhts-lint $(METADATA)
diff --git a/selinux-policy/systemd-machined-and-similar/main.fmf b/selinux-policy/systemd-machined-and-similar/main.fmf
index 4dc0eb6..18c8819 100644
--- a/selinux-policy/systemd-machined-and-similar/main.fmf
+++ b/selinux-policy/systemd-machined-and-similar/main.fmf
@@ -36,6 +36,9 @@ link:
- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1900888
- verifies: https://issues.redhat.com/browse/RHEL-49567
- verifies: https://issues.redhat.com/browse/RHEL-74280
+ - verifies: https://issues.redhat.com/browse/RHEL-76352
+ - verifies: https://issues.redhat.com/browse/RHEL-77087
+ - verifies: https://issues.redhat.com/browse/RHEL-78088
adjust:
- enabled: false
when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-alt-7
diff --git a/selinux-policy/systemd-machined-and-similar/runtest.sh b/selinux-policy/systemd-machined-and-similar/runtest.sh
index a15fd7d..d4aa98e 100755
--- a/selinux-policy/systemd-machined-and-similar/runtest.sh
+++ b/selinux-policy/systemd-machined-and-similar/runtest.sh
@@ -98,10 +98,12 @@ rlJournalStart
rlPhaseStartTest "RHEL-49567"
rlSEMatchPathCon "/usr/lib/systemd/systemd-machined" "systemd_machined_exec_t"
- rlSEMatchPathCon "/run/systemd/machine" "systemd_machined_var_run_t"
- rlSEMatchPathCon "/run/systemd/machine/io.systemd.Machine" "systemd_machined_var_run_t"
- rlSESearchRule "allow systemd_machined_t systemd_machined_var_run_t : dir { create } [ ]"
- rlSESearchRule "allow systemd_machined_t systemd_machined_var_run_t : sock_file { create unlink } [ ]"
+ if ! rlIsRHEL 9 && ! rlIsCentOS 9 ; then
+ rlSEMatchPathCon "/run/systemd/machine" "systemd_machined_var_run_t"
+ rlSEMatchPathCon "/run/systemd/machine/io.systemd.Machine" "systemd_machined_var_run_t"
+ rlSESearchRule "allow systemd_machined_t systemd_machined_var_run_t : dir { create } [ ]"
+ rlSESearchRule "allow systemd_machined_t systemd_machined_var_run_t : sock_file { create unlink } [ ]"
+ fi
rlRun "machinectl"
rlPhaseEnd
@@ -112,12 +114,20 @@ rlJournalStart
rlPhaseEnd
fi
+ if ! rlIsRHEL 8 && ! rlIsCentOS 8 ; then
+ rlPhaseStartTest "RHEL-76352 + RHEL-77087 + RHEL-78088"
+ rlSESearchRule "allow systemd_machined_t unconfined_service_t : dir { search } [ ]"
+ rlSESearchRule "allow systemd_machined_t unconfined_service_t : file { getattr open read ioctl } [ ]"
+ rlSESearchRule "allow systemd_machined_t systemd_machined_t : cap_userns { kill } [ ]"
+ rlPhaseEnd
+ fi
+
rlPhaseStartTest "real scenario -- standalone service"
if ! rlSEDefined ${PROCESS_CONTEXT} ; then
PROCESS_CONTEXT="unconfined_service_t"
fi
rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status" 1
- rlRun "restorecon -Rv /run /var -e /var/ARTIFACTS" 0-255
+ rlRun "restorecon -Rv /etc /run /var -e /var/ARTIFACTS" 0-255
rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "restart status stop status" 1
rlPhaseEnd
@@ -135,9 +145,11 @@ rlJournalStart
rlRun "machinectl list"
rlRun "machinectl status test"
rlWatchdog "machinectl login test" 20
- rlRun "rm -f /tmp/id"
- rlRun "machinectl copy-to test /usr/bin/id /tmp/id"
- rlRun "machinectl copy-from test /usr/bin/id /tmp/id"
+ if rlIsFedora ; then
+ rlRun "rm -f /tmp/id"
+ rlRun "machinectl copy-to test /usr/bin/id /tmp/id"
+ rlRun "machinectl copy-from test /usr/bin/id /tmp/id"
+ fi
rlRun "machinectl reboot test"
sleep 15
rlRun "machinectl status test"
reply other threads:[~2026-09-11 13:22 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=178913294218.1.1010703555260974732.tests-selinux-255c7cda9260@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