Skip to contentSkip to conversation

Remove the lockdown test

PATCH In review Ondrej Mosnacek 1 participant 2 messages Sep 30, 2021 – Oct 1, 2021 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove the lockdown test

The lockdown class is about to be removed from the mainline kernel due to the difficulty of ensuring that a relevant subject context is available during each call to the locked_down hook.

Hence remove the lockdown test from the testsuite.

Note that the module_load and perf_event test policy still conditionally provides rules involving the lockdown class so that these tests can still work on older kernels.

---
 policy/Makefile         |  3 ++-
 policy/test_lockdown.te | 54 -----------------------------------------
 policy/test_policy.if   | 17 -------------
 tests/Makefile          |  4 ---
 tests/lockdown/Makefile |  2 --
 tests/lockdown/test     | 47 -----------------------------------
 6 files changed, 2 insertions(+), 125 deletions(-)
 delete mode 100644 policy/test_lockdown.te
 delete mode 100644 tests/lockdown/Makefile
 delete mode 100755 tests/lockdown/test
policy/Makefile +2 -1
index 5e5ccda..66734c6 100644
@@ -143,8 +143,9 @@ TARGETS += test_perf_event.te
 endif
 endif
 
+# Older kernels may still have the legacy lockdown class, so we need to add
+# the appropriate rules when the policy declares it.
 ifeq ($(shell grep -q lockdown $(POLDEV)/include/support/all_perms.spt && echo true),true)
-TARGETS += test_lockdown.te
 export M4PARAM += -Dlockdown_defined
 endif
 
policy/test_lockdown.te deleted +0 -54

54 lines not on this page · raw message

policy/test_policy.if +0 -17
index 7023e30..e3c01c8 100644
@@ -87,20 +87,3 @@ interface(`userdom_search_admin_dir', `
 ifdef(`kernel_request_load_module', `', ` dnl
 interface(`kernel_request_load_module', `')
 ')
-
-# We need to open-code these interfaces, because the system-provided ones will
-# likely grant the lockdown permissions we want to test.
-interface(`testsuite_read_debugfs_nolockdown',`
-	gen_require(`
-		type debugfs_t;
-	')
-
-	read_files_pattern($1, debugfs_t, debugfs_t)
-')
-interface(`testsuite_read_tracefs_nolockdown',`
-	gen_require(`
-		type tracefs_t;
-	')
-
-	read_files_pattern($1, tracefs_t, tracefs_t)
-')
tests/Makefile +0 -4
index cbff490..3f7cae3 100644
@@ -112,10 +112,6 @@ SUBDIRS += perf_event
 endif
 endif
 
-ifeq ($(shell grep -q lockdown $(POLDEV)/include/support/all_perms.spt && echo true),true)
-SUBDIRS += lockdown
-endif
-
 ifeq ($(shell grep -q filesystem $(POLDEV)/include/support/all_perms.spt && echo true),true)
 SUBDIRS += $(addprefix filesystem/,$(FILESYSTEMS))
 ifeq ($(shell grep -q all_filesystem_perms.*watch $(POLDEV)/include/support/all_perms.spt && echo true),true)
tests/lockdown/Makefile deleted +0 -2
deleted file mode 100644
index e7c006f..0000000
@@ -1,2 +0,0 @@
-all:
-clean:
tests/lockdown/test deleted +0 -47

47 lines not on this page · raw message

Signature · 1 line
2.31.1
#1 lore raw
Quoted 11 lines · Ondrej Mosnacek

The lockdown class is about to be removed from the mainline kernel due to the difficulty of ensuring that a relevant subject context is available during each call to the locked_down hook.

Hence remove the lockdown test from the testsuite.

Note that the module_load and perf_event test policy still conditionally provides rules involving the lockdown class so that these tests can still work on older kernels.

The removal is now merged in next, so I went ahead and applied this:
https://github.com/SELinuxProject/selinux-testsuite/commit/bba37c007a0c7a12dd603bdac5e4431796f3e2e1

Signature · 3 lines
Ondrej Mosnacek
Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.