Skip to contentSkip to conversation

Add extended_anon_inode_class policy capability support

RFC PATCH New Ondrej Mosnacek 1 participant 1 message Apr 21, 2021 SELinux security module

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Add extended_anon_inode_class policy capability support

The extended_anon_inode_class policy capability allows to distinguish different types of anon inodes by class. Add necessary mechanisms to the userfaultfd test policy so that the test works correctly also when this capability is enabled by the system policy.

---
 policy/Makefile                     |   8 +-
 policy/test_anon_inode_extended.cil |   1 +
 policy/test_anon_inode_legacy.cil   |   1 +
 policy/test_userfaultfd.cil         | 127 ++++++++++++++++------------
 4 files changed, 84 insertions(+), 53 deletions(-)
 create mode 100644 policy/test_anon_inode_extended.cil
 create mode 100644 policy/test_anon_inode_legacy.cil
policy/Makefile +7 -1
index 91364d5..33951a5 100644
@@ -41,7 +41,13 @@ CIL_TARGETS = test_mlsconstrain.cil test_overlay_defaultrange.cil
 ifeq ($(shell [ $(MOD_POL_VERS) -ge 18 -a $(MAX_KERNEL_POLICY) -ge 30 ] && echo true),true)
 CIL_TARGETS += test_userfaultfd.cil
 TARGETS += test_userfaultfd.te
-endif
+ifeq ($(shell cat $(SELINUXFS)/policy_capabilities/extended_anon_inode_class \
+	2>/dev/null || echo 0),1)
+CIL_TARGETS += test_anon_inode_extended.cil
+else
+CIL_TARGETS += test_anon_inode_legacy.cil
+endif # policy_capabilities/extended_anon_inode_class
+endif # extended permissions
 ifeq ($(shell [ $(MAX_KERNEL_POLICY) -ge 32 ] && echo true),true)
 ifeq ($(shell [ $(POL_VERS) -ge 32 ] && echo true),true)
 # If other MLS tests get written this can be moved outside of the glblub test
policy/test_anon_inode_extended.cil new file +1 -0
new file mode 100644
index 0000000..af5b0d2
@@ -0,0 +1 @@
+(tunable extended_anon_inode true)
policy/test_anon_inode_legacy.cil new file +1 -0
new file mode 100644
index 0000000..4c81e91
@@ -0,0 +1 @@
+(tunable extended_anon_inode false)
policy/test_userfaultfd.cil +75 -52

127 lines not on this page · raw message

Signature · 1 line
2.30.2