public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Ondrej Mosnacek <omosnace@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: Add test for genfscon fallback support
Date: Fri, 11 Sep 2026 13:18:56 GMT	[thread overview]
Message-ID: <178913273694.1.7137214110197732146.tests-selinux-6548af6fcf9d@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 6548af6fcf9d0d6bc0a53190f078914fd1fa5513
            Author : Ondrej Mosnacek <omosnace@redhat.com>
            Date   : 2021-03-26T14:30:48+01:00
            Stats  : +67/-0 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/6548af6fcf9d0d6bc0a53190f078914fd1fa5513?branch=pr775-checkpolicy-revdeps

            Log:
            Add test for genfscon fallback support

This feature is required for proper support of virtiofs with SELinux.
Add a trivial test that verifies that this feature works via a dummy
SELinux module and ramfs mount.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>

---
diff --git a/kernel/genfs_fallback/Makefile b/kernel/genfs_fallback/Makefile
new file mode 100644
index 0000000..7abf97c
--- /dev/null
+++ b/kernel/genfs_fallback/Makefile
@@ -0,0 +1,7 @@
+# Minimal Makefile for standard-test-roles-beakerlib
+
+R="RhtsRequires: policycoreutils"
+
+run:
+	chmod +x runtest.sh
+	./runtest.sh

diff --git a/kernel/genfs_fallback/main.fmf b/kernel/genfs_fallback/main.fmf
new file mode 100644
index 0000000..4006f0b
--- /dev/null
+++ b/kernel/genfs_fallback/main.fmf
@@ -0,0 +1,29 @@
+summary: Test genfscon fallback for fs_use_xattr when no xattr support
+description: |
+    Test that a fs_use_xattr filesystem mount falls back to genfscon when it
+    doesn't have xattr support.
+
+    See also:
+    https://lore.kernel.org/selinux/CAFqZXNsGabHBfV36nNAVLJgEzjkBev-O3YZ1vnmXyVoaDdjiHQ@mail.gmail.com/T/
+    https://lore.kernel.org/selinux/20210113123802.63563-1-omosnace@redhat.com/
+contact: Ondrej Mosnacek <omosnace@redhat.com>
+component:
+- kernel
+framework: beakerlib
+require:
+- policycoreutils
+duration: 5m
+tier: 2
+enabled: true
+adjust:
+    enabled: false
+    when: distro < rhel-8.5
+    because: RHEL-8.5 and below are not expected to support this
+adjust:
+    enabled: false
+    when: distro < fedora-35
+    because: This feature may not be supported on kernels in F34 and below
+link:
+- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1899703
+- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1915825
+- verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1937297

diff --git a/kernel/genfs_fallback/runtest.sh b/kernel/genfs_fallback/runtest.sh
new file mode 100755
index 0000000..63d8e1e
--- /dev/null
+++ b/kernel/genfs_fallback/runtest.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# SPDX-License-Identifier: GPLv2
+# Copyright (c) 2021 Red Hat, Inc.
+# Author: Ondrej Mosnacek <omosnace@redhat.com>
+
+# Include Beakerlib environment
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "uname -r"
+
+        rlRun "echo '(fsuse xattr ramfs (system_u object_r fs_t ((s0) (s0))))' >ramfs_xattr.cil"
+        rlRun "semodule -i ramfs_xattr.cil"
+        rlRun "mkdir /mnt/test-ramfs"
+    rlPhaseEnd
+
+    rlPhaseStartTest
+        rlRun "mount -t ramfs none /mnt/test-ramfs"
+        rlRun "[ \"\$(secon -t -f /mnt/test-ramfs)\" = ramfs_t ]"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "umount /mnt/test-ramfs" 0-1
+        rlRun "rmdir /mnt/test-ramfs"
+        rlRun "semodule -r ramfs_xattr"
+        rlRun "rm -f ramfs_xattr.cil"
+    rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd

                 reply	other threads:[~2026-09-11 13:18 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=178913273694.1.7137214110197732146.tests-selinux-6548af6fcf9d@fedoraproject.org \
    --to=omosnace@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