public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: kernel/labeled-cephfs: test also special file types
@ 2026-09-11 13:18 Ondrej Mosnacek
  0 siblings, 0 replies; only message in thread
From: Ondrej Mosnacek @ 2026-09-11 13:18 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : c63ac79b2e0c66a9df05f1e13d30ea9c6ddaf014
            Author : Ondrej Mosnacek <omosnace@redhat.com>
            Date   : 2020-08-05T09:15:32+02:00
            Stats  : +37/-1 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/c63ac79b2e0c66a9df05f1e13d30ea9c6ddaf014?branch=pr775-checkpolicy-revdeps

            Log:
            kernel/labeled-cephfs: test also special file types

An issue was found in CephFS that caused symlinks to be left unlabeled
upon creation. Extend the test to cover also symlinks, special file
types, and directories.

Upstream fix: https://marc.info/?l=ceph-devel&m=159596407215153&w=2

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

---
diff --git a/kernel/labeled-cephfs/runtest.sh b/kernel/labeled-cephfs/runtest.sh
index 83c92f9..7acdb6e 100755
--- a/kernel/labeled-cephfs/runtest.sh
+++ b/kernel/labeled-cephfs/runtest.sh
@@ -14,7 +14,7 @@ function check_config() {
 }
 
 function get_file_con() {
-    getfattr --absolute-names --only-values -n security.selinux "$1" | tr -d '\000'
+    getfattr -h --absolute-names --only-values -n security.selinux "$1" | tr -d '\000'
 }
 
 function strip_mls() {
@@ -109,8 +109,20 @@ rlJournalStart
             check_file_con "/mnt/myceph/test" "$SEUSER:object_r:unlabeled_t:s0"
             rlRun "chcon system_u:object_r:usr_t:s0 /mnt/myceph/test"
             check_file_con "/mnt/myceph/test" "system_u:object_r:usr_t:s0"
+
             rlRun "touch /mnt/myceph/test/file"
+            rlRun "mkdir /mnt/myceph/test/dir"
+            rlRun "ln -s /etc /mnt/myceph/test/symlink"
+            rlRun "mknod /mnt/myceph/test/fifo p"
+            rlRun "mknod /mnt/myceph/test/block b 1 3"
+            rlRun "mknod /mnt/myceph/test/char c 1 3"
+
             check_file_con "/mnt/myceph/test/file" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/dir" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/symlink" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/fifo" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/block" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/char" "$SEUSER:object_r:usr_t:s0"
         elif rlIsEL '>=8.3'; then
             # RHEL-8 - genfscon + xattr handling
             # See: https://bugzilla.redhat.com/show_bug.cgi?id=1823764
@@ -121,8 +133,20 @@ rlJournalStart
             check_file_con "/mnt/myceph/test" "$SEUSER:object_r:cephfs_t:s0"
             rlRun "chcon system_u:object_r:usr_t:s0 /mnt/myceph/test"
             check_file_con "/mnt/myceph/test" "system_u:object_r:usr_t:s0"
+
             rlRun "touch /mnt/myceph/test/file"
+            rlRun "mkdir /mnt/myceph/test/dir"
+            rlRun "ln -s /etc /mnt/myceph/test/symlink"
+            rlRun "mknod /mnt/myceph/test/fifo p"
+            rlRun "mknod /mnt/myceph/test/block b 1 3"
+            rlRun "mknod /mnt/myceph/test/char c 1 3"
+
             check_file_con "/mnt/myceph/test/file" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/dir" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/symlink" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/fifo" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/block" "$SEUSER:object_r:usr_t:s0"
+            check_file_con "/mnt/myceph/test/char" "$SEUSER:object_r:usr_t:s0"
         else
             # F31 and below - just genfscon
             check_file_con "/mnt/myceph" "system_u:object_r:cephfs_t:s0"
@@ -130,8 +154,20 @@ rlJournalStart
             check_file_con "/mnt/myceph/test" "system_u:object_r:cephfs_t:s0"
             rlRun "chcon system_u:object_r:usr_t:s0 /mnt/myceph/test" 1
             check_file_con "/mnt/myceph/test" "system_u:object_r:cephfs_t:s0"
+
             rlRun "touch /mnt/myceph/test/file"
+            rlRun "mkdir /mnt/myceph/test/dir"
+            rlRun "ln -s /etc /mnt/myceph/test/symlink"
+            rlRun "mknod /mnt/myceph/test/fifo p"
+            rlRun "mknod /mnt/myceph/test/block b 1 3"
+            rlRun "mknod /mnt/myceph/test/char c 1 3"
+
             check_file_con "/mnt/myceph/test/file" "system_u:object_r:cephfs_t:s0"
+            check_file_con "/mnt/myceph/test/dir" "system_u:object_r:cephfs_t:s0"
+            check_file_con "/mnt/myceph/test/symlink" "system_u:object_r:cephfs_t:s0"
+            check_file_con "/mnt/myceph/test/fifo" "system_u:object_r:cephfs_t:s0"
+            check_file_con "/mnt/myceph/test/block" "system_u:object_r:cephfs_t:s0"
+            check_file_con "/mnt/myceph/test/char" "system_u:object_r:cephfs_t:s0"
         fi
     rlPhaseEnd
 

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

only message in thread, other threads:[~2026-09-11 13:18 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:18 [tests/selinux] pr775-checkpolicy-revdeps: kernel/labeled-cephfs: test also special file types Ondrej Mosnacek

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