public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] main: kernel/overlayfs-mmap-bugs: add coverage for CVE-2026-98214
@ 2026-11-23 15:27 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-11-23 15:27 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : main
            Commit : 037f385047f99929603257f07014c388e4efd342
            Author : Ondrej Mosnáček <omosnacek@gmail.com>
            Date   : 2026-11-20T10:46:56+01:00
            Stats  : +65/-14 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/037f385047f99929603257f07014c388e4efd342?branch=main

            Log:
            kernel/overlayfs-mmap-bugs: add coverage for CVE-2026-98214

Signed-off-by: Ondrej Mosnáček <omosnacek@gmail.com>

---
diff --git a/kernel/overlayfs-mmap-bugs/main.fmf b/kernel/overlayfs-mmap-bugs/main.fmf
index 8ff2402..f94f3d1 100644
--- a/kernel/overlayfs-mmap-bugs/main.fmf
+++ b/kernel/overlayfs-mmap-bugs/main.fmf
@@ -1,7 +1,7 @@
 summary: Regression test for overlayfs mmap/mprotect bugs
 description: |
     Tests various scenarios with overlayfs and mmap/mprotect syscalls.
-    This also covers CVE-2026-46054.
+    This also covers CVE-2026-46054 and CVE-2026-98214.
 contact: Ondrej Mosnacek <omosnace@redhat.com>
 component:
   - kernel
@@ -18,6 +18,13 @@ link:
   - verifies: https://redhat.atlassian.net/browse/RHEL-185115
   - verifies: https://redhat.atlassian.net/browse/RHEL-185117
   - verifies: https://redhat.atlassian.net/browse/RHEL-185118
+  - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2026-98214
+  - verifies: https://redhat.atlassian.net/browse/RHEL-304624
+  - verifies: https://redhat.atlassian.net/browse/RHEL-304629
+  - verifies: https://redhat.atlassian.net/browse/RHEL-304632
+  - verifies: https://redhat.atlassian.net/browse/RHEL-304633
+  - verifies: https://redhat.atlassian.net/browse/RHEL-304635
+  - verifies: https://redhat.atlassian.net/browse/RHEL-304636
 environment:
     AVC_ERROR: +no_avc_check
 check:

diff --git a/kernel/overlayfs-mmap-bugs/runtest.sh b/kernel/overlayfs-mmap-bugs/runtest.sh
index 1cb3ab0..c542d20 100755
--- a/kernel/overlayfs-mmap-bugs/runtest.sh
+++ b/kernel/overlayfs-mmap-bugs/runtest.sh
@@ -26,54 +26,97 @@ rlJournalStart
             "Build the test policy"
         rlRun "semodule -i test_policy.pp" 0 "Load test policy"
 
-        rlRun "mkdir lowerdir upperdir workdir mountpoint" 0 "Create test dirs"
+        rlRun "mkdir lowerdir" 0 "Create lowerdir"
         rlRun "touch lowerdir/file_ok lowerdir/file_no_map lowerdir/file_no_read lowerdir/file_no_write" 0 \
             "Create test files"
-        rlRun "chcon -R -t test_lowerfile_t lowerdir workdir upperdir"
+        rlRun "chcon -R -t test_lowerfile_t lowerdir"
         rlRun "chcon -t test_lowerfile_no_map_t lowerdir/file_no_map"
         rlRun "chcon -t test_lowerfile_no_write_t lowerdir/file_no_write"
         rlRun "chcon -t test_lowerfile_no_read_t lowerdir/file_no_read"
-
-        rlRun "runcon -t test_mounter_t mount -t overlay none -o 'context=$OVERLAYCON,lowerdir=./lowerdir,upperdir=./upperdir,workdir=./workdir' ./mountpoint" 0 \
-            "Mount the overlay filesystem"
+        for layer in layer1 layer2; do
+            rlRun "mkdir $layer"
+            rlRun "mkdir $layer/upperdir $layer/workdir $layer/mountpoint" 0 \
+                "Create test dirs ($layer)"
+            rlRun "chcon -R -t test_lowerfile_t $layer/workdir $layer/upperdir"
+        done
 
         rlRun ":>/var/log/audit/audit.log; rm -f /var/log/audit/audit.log.*" 0 \
             "Clear the audit log"
+
+        rlRun "runcon -t test_mounter_t mount -t overlay none -o 'context=$OVERLAYCON,lowerdir=./lowerdir,upperdir=./layer1/upperdir,workdir=./layer1/workdir' layer1/mountpoint" 0 \
+            "Mount the overlay filesystem (1st layer)"
     rlPhaseEnd
 
     rlPhaseStartTest "CVE-2026-46054"
         # Bug 1
         # Should get below AVC:
         # avc:  denied  { map } for scontext=...test_mounter_t... tcontext=...test_lowerfile_no_map_t... tclass=file
-        rlRun "runcon -t test_access_full_t ./map_access ./mountpoint/file_no_map RDONLY SHARED" 3 "Test Bug 1"
+        rlRun "runcon -t test_access_full_t ./map_access ./layer1/mountpoint/file_no_map RDONLY SHARED" 3 "Test Bug 1"
 
         # Bug 2, result 1
         # Shouldn't get below AVC:
         # avc:  denied  { use } for scontext=...test_access_full_t... tcontext=...test_mounter_t... tclass=fd
         rlRun "setsebool domain_fd_use 0"
-        rlRun "runcon -t test_access_full_t ./map_access ./mountpoint/file_ok RDONLY SHARED" 0 "Test Bug 2, result 1"
+        rlRun "runcon -t test_access_full_t ./map_access ./layer1/mountpoint/file_ok RDONLY SHARED" 0 "Test Bug 2, result 1"
         rlRun "setsebool domain_fd_use 1"
 
         # Bug 2, result 2
         # Shouldn't get below AVC:
         # avc:  denied  { read } for scontext=...test_access_full_t... tcontext=...test_lowerfile_t... tclass=file
-        rlRun "runcon -t test_access_full_t ./map_access ./mountpoint/file_ok RDONLY SHARED" 0 "Test Bug 2, result 2"
+        rlRun "runcon -t test_access_full_t ./map_access ./layer1/mountpoint/file_ok RDONLY SHARED" 0 "Test Bug 2, result 2"
 
         # Bug 2, result 3
         # Should get below AVC:
         # avc:  denied  { read } for scontext=...test_access_exploit_t... tcontext=...test_mountedfile_t... tclass=file
-        rlRun "runcon -t test_access_full_t ./map_access ./mountpoint/file_ok RDONLY SHARED $DYNTRANSCON" 5 "Test Bug 2, result 3"
+        rlRun "runcon -t test_access_full_t ./map_access ./layer1/mountpoint/file_ok RDONLY SHARED $DYNTRANSCON" 5 "Test Bug 2, result 3"
     rlPhaseEnd
 
     rlPhaseStartTest "execmem regression"
-        rlRun "runcon -t test_access_full_t ./map_access ./mountpoint/file_ok RDONLY PRIVATE" 0 "Verify no execmem denied"
+        rlRun "runcon -t test_access_full_t ./map_access ./layer1/mountpoint/file_ok RDONLY PRIVATE" 0 "Verify no execmem denied"
+    rlPhaseEnd
+
+    rlPhaseStartTest "CVE-2026-46054 - 2 layers"
+        rlLog "Retry CVE-2026-46054 tests with two layers of overlayfs"
+        rlLog "This also verifies CVE-2026-98214"
+
+        rlRun "umount ./layer1/mountpoint"
+
+        rlRun "runcon -t test_mounter_t mount -t overlay none -o 'lowerdir=./lowerdir,upperdir=./layer1/upperdir,workdir=./layer1/workdir' layer1/mountpoint" 0 \
+            "Mount the overlay filesystem (1st layer)"
+
+        rlRun "runcon -t test_mounter_t mount -t overlay none -o 'context=$OVERLAYCON,lowerdir=./layer1/mountpoint,upperdir=./layer2/upperdir,workdir=./layer2/workdir' layer2/mountpoint" 0 \
+            "Mount the overlay filesystem (2nd layer)"
+
+        # Bug 1
+        # Should get below AVC:
+        # avc:  denied  { map } for scontext=...test_mounter_t... tcontext=...test_lowerfile_no_map_t... tclass=file
+        rlRun "runcon -t test_access_full_t ./map_access ./layer2/mountpoint/file_no_map RDONLY SHARED" 3 "Test Bug 1"
+
+        # Bug 2, result 1
+        # Shouldn't get below AVC:
+        # avc:  denied  { use } for scontext=...test_access_full_t... tcontext=...test_mounter_t... tclass=fd
+        rlRun "setsebool domain_fd_use 0"
+        rlRun "runcon -t test_access_full_t ./map_access ./layer2/mountpoint/file_ok RDONLY SHARED" 0 "Test Bug 2, result 1"
+        rlRun "setsebool domain_fd_use 1"
+
+        # Bug 2, result 2
+        # Shouldn't get below AVC:
+        # avc:  denied  { read } for scontext=...test_access_full_t... tcontext=...test_lowerfile_t... tclass=file
+        rlRun "runcon -t test_access_full_t ./map_access ./layer2/mountpoint/file_ok RDONLY SHARED" 0 "Test Bug 2, result 2"
+
+        # Bug 2, result 3
+        # Should get below AVC:
+        # avc:  denied  { read } for scontext=...test_access_exploit_t... tcontext=...test_mountedfile_t... tclass=file
+        rlRun "runcon -t test_access_full_t ./map_access ./layer2/mountpoint/file_ok RDONLY SHARED $DYNTRANSCON" 5 "Test Bug 2, result 3"
     rlPhaseEnd
 
     rlPhaseStartCleanup
         rlRun "ausearch -i -m avc" 0 "Show AVC denials"
 
-        rlRun "umount ./mountpoint"
-        rlRun "rm -rf lowerdir upperdir workdir mountpoint"
+        rlRun "umount ./layer2/mountpoint"
+        rlRun "umount ./layer1/mountpoint"
+        rlRun "rm -rf lowerdir layer1 layer2"
+
         rlRun "semodule -r test_policy" 0 "Unload test policy"
         rlRun "make -f /usr/share/selinux/devel/Makefile clean" 0 \
             "Clean the test policy"

diff --git a/kernel/overlayfs-mmap-bugs/test_policy.te b/kernel/overlayfs-mmap-bugs/test_policy.te
index 03f1858..d5182c6 100644
--- a/kernel/overlayfs-mmap-bugs/test_policy.te
+++ b/kernel/overlayfs-mmap-bugs/test_policy.te
@@ -40,7 +40,7 @@ write_files_pattern(test_mounter_t, test_lowerfile_no_read_t, test_lowerfile_no_
 allow test_mounter_t test_lowerfile_no_read_t:file map;
 
 allow test_mounter_t test_mountedfile_t:dir { getattr setattr };
-allow test_mounter_t test_mountedfile_t:filesystem { relabelfrom relabelto mount };
+allow test_mounter_t test_mountedfile_t:filesystem { getattr relabelfrom relabelto mount };
 
 kernel_read_system_state(test_mounter_t)
 kernel_read_proc_symlinks(test_mounter_t)
@@ -49,6 +49,7 @@ kernel_search_proc(test_mounter_t)
 
 fs_getattr_xattr_fs(test_mounter_t)
 fs_relabelfrom_xattr_fs(test_mounter_t)
+fs_mount_xattr_fs(test_mounter_t)
 
 mount_entry_type(test_mounter_t)
 mount_manage_pid_files(test_mounter_t)

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

only message in thread, other threads:[~2026-11-23 15:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 15:27 [tests/selinux] main: kernel/overlayfs-mmap-bugs: add coverage for CVE-2026-98214 

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