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 policy rebuild affects layered containers
Date: Fri, 11 Sep 2026 13:19:57 GMT	[thread overview]
Message-ID: <178913279700.1.934205444397017307.tests-selinux-dbc896ebd610@fedoraproject.org> (raw)

            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
+

                 reply	other threads:[~2026-09-11 13:19 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=178913279700.1.934205444397017307.tests-selinux-dbc896ebd610@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