public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test if policy rebuild affects layered containers
@ 2026-09-11 13:19 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:19 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : dbc896ebd6104799bac8d9a33280f999f17d26ca
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2022-05-04T13:17:48+00:00
            Stats  : +175/-0 in 4 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/dbc896ebd6104799bac8d9a33280f999f17d26ca?branch=pr775-checkpolicy-revdeps

            Log:
            test if policy rebuild affects layered containers

Following error messages appeared when 2 containers (one derived
the other) both manipulate the SELinux policy store:

  libsemanage.semanage_commit_sandbox: Error while renaming
  /var/lib/selinux/targeted/active to /var/lib/selinux/targeted/previous.
  (Invalid cross-device link).
  semodule:  Failed!
  Error: error building at STEP "RUN semodule -B": error while running
  runtime: exit status 1

Purpose of this automated test is to find out if this situation still
happens or not.

The TC covers BZ#2068085.

---
diff --git a/libsemanage/cross-device-link-in-containers/Makefile b/libsemanage/cross-device-link-in-containers/Makefile
new file mode 100644
index 0000000..cc5b0cd
--- /dev/null
+++ b/libsemanage/cross-device-link-in-containers/Makefile
@@ -0,0 +1,64 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Makefile of /CoreOS/libsemanage/Regression/cross-device-link-in-containers
+#   Description: Does rebuild of policy affect layered containers?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2022 Red Hat, Inc.
+#
+#   This program is free software: you can redistribute it and/or
+#   modify it under the terms of the GNU General Public License as
+#   published by the Free Software Foundation, either version 2 of
+#   the License, or (at your option) any later version.
+#
+#   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 http://www.gnu.org/licenses/.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/libsemanage/Regression/cross-device-link-in-containers
+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)
+	test -x runtest.sh || chmod a+x 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:     Does rebuild of policy affect layered containers?" >> $(METADATA)
+	@echo "Type:            Regression" >> $(METADATA)
+	@echo "TestTime:        10m" >> $(METADATA)
+	@echo "RunFor:          libsemanage" >> $(METADATA)
+	@echo "Requires:        libsemanage podman policycoreutils selinux-policy libselinux-utils" >> $(METADATA)
+	@echo "Priority:        Normal" >> $(METADATA)
+	@echo "License:         GPLv2+" >> $(METADATA)
+	@echo "Confidential:    no" >> $(METADATA)
+	@echo "Destructive:     no" >> $(METADATA)
+	@echo "Releases:        -RHEL4 -RHEL5 -RHEL6 -RHEL7" >> $(METADATA)
+	@echo "Bug:             2068085" >> $(METADATA) # RHEL-9
+
+	rhts-lint $(METADATA)
+

diff --git a/libsemanage/cross-device-link-in-containers/PURPOSE b/libsemanage/cross-device-link-in-containers/PURPOSE
new file mode 100644
index 0000000..1f8a6d1
--- /dev/null
+++ b/libsemanage/cross-device-link-in-containers/PURPOSE
@@ -0,0 +1,5 @@
+PURPOSE of /CoreOS/libsemanage/Regression/cross-device-link-in-containers
+Author: Milos Malik <mmalik@redhat.com>
+
+Description: Does rebuild of policy affect layered containers?
+

diff --git a/libsemanage/cross-device-link-in-containers/main.fmf b/libsemanage/cross-device-link-in-containers/main.fmf
new file mode 100644
index 0000000..72ddbf7
--- /dev/null
+++ b/libsemanage/cross-device-link-in-containers/main.fmf
@@ -0,0 +1,30 @@
+summary: Does rebuild of policy affect layered containers?
+description: |+
+    Does rebuild of policy affect layered containers?
+
+contact: Milos Malik <mmalik@redhat.com>
+component:
+  - libsemanage
+recommend:
+  - libsemanage
+  - podman
+  - policycoreutils
+  - selinux-policy
+  - libselinux-utils
+duration: 10m
+enabled: true
+tag:
+  - NoRHEL4
+  - NoRHEL5
+  - NoRHEL6
+  - NoRHEL7
+  - targeted
+link:
+  - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2068085
+adjust:
+  - enabled: false
+    when: distro == rhel-4, rhel-5, rhel-6, rhel-7
+    continue: false
+extra-summary: /CoreOS/libsemanage/Regression/cross-device-link-in-containers
+extra-task: /CoreOS/libsemanage/Regression/cross-device-link-in-containers
+extra-nitrate: TC#0613557

diff --git a/libsemanage/cross-device-link-in-containers/runtest.sh b/libsemanage/cross-device-link-in-containers/runtest.sh
new file mode 100755
index 0000000..782bbc2
--- /dev/null
+++ b/libsemanage/cross-device-link-in-containers/runtest.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/libsemanage/Regression/cross-device-link-in-containers
+#   Description: Does rebuild of policy affect layered containers?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2022 Red Hat, Inc.
+#
+#   This program is free software: you can redistribute it and/or
+#   modify it under the terms of the GNU General Public License as
+#   published by the Free Software Foundation, either version 2 of
+#   the License, or (at your option) any later version.
+#
+#   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 http://www.gnu.org/licenses/.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="libsemanage"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlAssertRpm ${PACKAGE}
+        rlAssertRpm podman
+        rlRun "semodule -lfull | grep -e container -e podman"
+        rlRun "getsebool -a | grep -e container -e podman"
+        rlRun "mkdir selinux1 selinux2"
+    rlPhaseEnd
+
+    rlPhaseStartTest "bz#2068085"
+        rlRun "pushd selinux1"
+cat <<EOF >> ./Dockerfile
+FROM quay.io/centos/centos:stream9
+RUN dnf install -y selinux-policy selinux-policy-targeted
+EOF
+        rlRun "cat ./Dockerfile"
+        rlRun -s "podman build -t localhost/selinux . --no-cache"
+        rlAssertGrep "^complete" $rlRun_LOG -i
+        rlAssertGrep "^commit" $rlRun_LOG -i
+        rlRun "popd"
+
+        rlRun "pushd selinux2"
+cat <<EOF >> ./Dockerfile
+FROM localhost/selinux
+RUN semodule -B
+EOF
+        rlRun "cat ./Dockerfile"
+        rlRun -s "podman build -t localhost/selinux2 . --no-cache"
+        rlAssertNotGrep "error" $rlRun_LOG -i
+        rlAssertNotGrep "failed" $rlRun_LOG -i
+        rlRun "popd"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "rm -rf selinux1 selinux2"
+        rlRun "podman images"
+        for ID in `podman images -q` ; do
+           rlRun "podman rmi $ID"
+        done
+        rlRun "podman images"
+    rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
+

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

only message in thread, other threads:[~2026-09-11 13:19 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:19 [tests/selinux] pr775-checkpolicy-revdeps: test if policy rebuild affects layered containers Milos Malik

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