Skip to contentSkip to conversation

selinux-testsuite: add tests for fsnotify

PATCH New Aaron Goidel 1 participant 1 message Aug 1, 2019 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selinux-testsuite: add tests for fsnotify

Added a suite to test permissions for setting inotify and fanotify watches on filesystem objects. Tests watch, watch_with_perm, and watch_reads permissions.

---
 policy/Makefile              |   4 ++
 policy/test_notify.te        |  94 +++++++++++++++++++++++++
 tests/Makefile               |   4 ++
 tests/notify/Makefile        |   5 ++
 tests/notify/test            | 133 +++++++++++++++++++++++++++++++++++
 tests/notify/test_fanotify.c | 107 ++++++++++++++++++++++++++++
 tests/notify/test_inotify.c  |  43 +++++++++++
 7 files changed, 390 insertions(+)
 create mode 100644 policy/test_notify.te
 create mode 100644 tests/notify/Makefile
 create mode 100755 tests/notify/test
 create mode 100644 tests/notify/test_fanotify.c
 create mode 100644 tests/notify/test_inotify.c
policy/Makefile +4 -0
index 305b572..65f88c5 100644
@@ -71,6 +71,10 @@ ifeq ($(shell grep -q corenet_sctp_bind_all_nodes $(POLDEV)/include/kernel/coren
 TARGETS += test_sctp.te
 endif
 
+ifeq ($(shell grep -q all_file_perms.*watch $(POLDEV)/include/support/all_perms.spt && echo true),true)
+TARGETS+=test_notify.te
+endif
+
 ifeq (x$(DISTRO),$(filter x$(DISTRO),xRHEL4 xRHEL5 xRHEL6))
 TARGETS:=$(filter-out test_overlayfs.te test_mqueue.te, $(TARGETS))
 endif
policy/test_notify.te new file +94 -0

94 lines not on this page · raw message

tests/Makefile +4 -0
index 63aa325..b99c96e 100644
@@ -50,6 +50,10 @@ ifeq ($(shell grep "^SELINUX_INFINIBAND_PKEY_TEST=" infiniband_pkey/ibpkey_test.
 SUBDIRS += infiniband_pkey
 endif
 
+ifeq ($(shell grep -q all_file_perms.*watch $(POLDEV)/include/support/all_perms.spt && echo true),true)
+SUBDIRS+=notify
+endif
+
 ifeq ($(DISTRO),RHEL4)
     SUBDIRS:=$(filter-out bounds dyntrace dyntrans inet_socket mmap nnp_nosuid overlay unix_socket, $(SUBDIRS))
 endif
tests/notify/Makefile new file +5 -0
new file mode 100644
index 0000000..78c4b3b
@@ -0,0 +1,5 @@
+TARGETS=test_inotify test_fanotify
+
+all: $(TARGETS)
+clean: 
+	rm -f $(TARGETS)
tests/notify/test new file +133 -0

133 lines not on this page · raw message

tests/notify/test_fanotify.c new file +107 -0

107 lines not on this page · raw message

tests/notify/test_inotify.c new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.21.0