Skip to contentSkip to conversation

Selinux tests for Infinfiband

PATCH In review Dan Jurgens 3 participants 15 messages May 30, 2017 – Jun 26, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

v2 cover Selinux tests for Infinfiband

From: Daniel Jurgens <[email protected]>

Implements new tests for Infiniband pkeys and endports. Because infiniband isn't widely used, and when it is the configuration is site specific, configuration files are used to enable the tests and set environment specific settings. When the tests are disable they always show as passed.

If enabled, the tests require correstponding updates to selinux, refpolicy, and the linux kernel.

---

v1:
- Synchronize intefrace names with changes to refpolicy.
- Change tests to not assume that default pkey is labeled.
- See patches v1 notes for more detail.

v2:
- Use ifdefs around new corenet_ib* interfaces.
- Exclude endport policy if infiniband_endport class is undefined.
- Use a stub makefile in tests/infinband_endport vs a new SUBDIRS_NO_MAKE list in the makefile.
- Style cleanup in new pkey test program.
- Updated README for new dependency.

Daniel Jurgens (2):
selinux-testsuite: Infiniband pkey tests
selinux-testsuite: Infiniband endport tests

 README                                       |  17 +++-
 policy/Makefile                              |   7 +-
 policy/test_ibendport.te                     |  40 ++++++++
 policy/test_ibpkey.te                        |  30 ++++++
 tests/Makefile                               |   4 +-
 tests/infiniband_endport/Makefile            |   2 +
 tests/infiniband_endport/ibendport_test.conf |  14 +++
 tests/infiniband_endport/test                |  49 ++++++++++
 tests/infiniband_pkey/Makefile               |   7 ++
 tests/infiniband_pkey/create_modify_qp.c     | 136 +++++++++++++++++++++++++++
 tests/infiniband_pkey/ibpkey_test.conf       |  18 ++++
 tests/infiniband_pkey/test                   |  84 +++++++++++++++++
 12 files changed, 404 insertions(+), 4 deletions(-)
 create mode 100644 policy/test_ibendport.te
 create mode 100644 policy/test_ibpkey.te
 create mode 100644 tests/infiniband_endport/Makefile
 create mode 100644 tests/infiniband_endport/ibendport_test.conf
 create mode 100755 tests/infiniband_endport/test
 create mode 100644 tests/infiniband_pkey/Makefile
 create mode 100644 tests/infiniband_pkey/create_modify_qp.c
 create mode 100644 tests/infiniband_pkey/ibpkey_test.conf
 create mode 100755 tests/infiniband_pkey/test
Signature · 1 line
2.12.2
#1 lore raw

PATCH v2 1/2 selinux-testsuite: Infiniband pkey tests

From: Daniel Jurgens <[email protected]>

New tests for infiniband pkeys. Most users don't have Infiniband hardware, and if they do the pkey configuration is not standardized. There is a configuration file for enabling the test and setting environment specific test configurations. If the tests are disabled they will always show as passed.

---
v1:
- Synchronized interface names with refpolicy changes.
- Changed pkey test to not assume the default pkey is labeled, instead it take a list of indexes with labeled and unlabeled pkeys. It checks that the labeled aren't allowed, unlabeled are allowed, and it labels the unlabeled ones to make sure they aren't allowed when labeled.

v2:
Stephen Smalley:
- Ifdef around new corenet_ib* interfaces.
- Updated README with libibverbs-devel dependency.
- Ran new test program through astyle with recommended settings.

---
 README                                   |  12 ++-
 policy/Makefile                          |   3 +-
 policy/test_ibpkey.te                    |  30 +++++++
 tests/Makefile                           |   4 +-
 tests/infiniband_pkey/Makefile           |   7 ++
 tests/infiniband_pkey/create_modify_qp.c | 136 +++++++++++++++++++++++++++++++
 tests/infiniband_pkey/ibpkey_test.conf   |  18 ++++
 tests/infiniband_pkey/test               |  84 +++++++++++++++++++
 8 files changed, 290 insertions(+), 4 deletions(-)
 create mode 100644 policy/test_ibpkey.te
 create mode 100644 tests/infiniband_pkey/Makefile
 create mode 100644 tests/infiniband_pkey/create_modify_qp.c
 create mode 100644 tests/infiniband_pkey/ibpkey_test.conf
 create mode 100644 tests/infiniband_pkey/test
README +11 -1
index deedae5..a4c8ebb 100644
@@ -68,8 +68,9 @@ libselinux-devel # to build some of the test programs
 net-tools # for ifconfig, used by capable_net/test
 netlabel_tools # to load NetLabel configuration during inet_socket tests
 iptables # to load iptables SECMARK rules during inet_socket tests
+libibverbs-devel # to build ibpkey test program.
 
-yum install perl-Test perl-Test-Harness perl-Test-Simple selinux-policy-devel gcc libselinux-devel net-tools netlabel_tools iptables
+yum install perl-Test perl-Test-Harness perl-Test-Simple selinux-policy-devel gcc libselinux-devel net-tools netlabel_tools iptables libibverbs-devel
 
 The testsuite requires a pre-existing base policy configuration of
 SELinux, using either the old example policy or the reference policy
@@ -195,3 +196,12 @@ establish a base directory (based on the path of the script
 executable).  This won't always be accurate, but will work for this
 test harness/configuration.
 	$basedir = $0;  $basedir =~ s|(.*)/[^/]*|$1|;
+
+INFINIBAND TESTS
+----------------
+Because running Infiniband tests requires specialized hardware you must
+set up a configuration file for these tests. The tests are disabled by
+default.  See comments in the configuration file for info.
+
+Infiniband PKey test conf file:
+tests/infiniband_pkey/ibpkey_test.conf
policy/Makefile +2 -1
index 7bc7f95..46c9fb5 100644
@@ -22,7 +22,8 @@ TARGETS = \
 	test_task_create.te test_task_getpgid.te test_task_getsched.te \
 	test_task_getsid.te test_task_setpgid.te test_task_setsched.te \
 	test_transition.te test_inet_socket.te test_unix_socket.te \
-	test_mmap.te test_overlayfs.te test_mqueue.te test_mac_admin.te
+	test_mmap.te test_overlayfs.te test_mqueue.te test_mac_admin.te \
+	test_ibpkey.te
 
 ifeq ($(shell [ $(POL_VERS) -ge 24 ] && echo true),true)
 TARGETS += test_bounds.te
policy/test_ibpkey.te new file +30 -0
new file mode 100644
index 0000000..373404c
@@ -0,0 +1,30 @@
+#################################
+#
+# Policy for testing Infiniband Pkey access.
+#
+
+attribute ibpkeydomain;
+
+# Domain for process.
+type test_ibpkey_access_t;
+domain_type(test_ibpkey_access_t)
+unconfined_runs_test(test_ibpkey_access_t)
+typeattribute test_ibpkey_access_t testdomain;
+typeattribute test_ibpkey_access_t ibpkeydomain;
+
+dev_rw_infiniband_dev(test_ibpkey_access_t)
+dev_rw_sysfs(test_ibpkey_access_t)
+
+# Define a pkey type for labeling pkeys during the test.
+type test_ibpkey_t;
+ifdef(`corenet_ib_pkey',`
+corenet_ib_pkey(test_ibpkey_t)
+')
+
+ifdef(`corenet_ib_access_unlabeled_pkeys',`
+corenet_ib_access_unlabeled_pkeys(test_ibpkey_access_t)
+')
+
+# Allow all of these domains to be entered from the sysadm domain.
+miscfiles_domain_entry_test_files(ibpkeydomain)
+userdom_sysadm_entry_spec_domtrans_to(ibpkeydomain)
tests/Makefile +2 -2
index fb8a0aa..7dfe2a8 100644
@@ -4,13 +4,13 @@ export CFLAGS+=-g -O0 -Wall -D_GNU_SOURCE
 
 DISTRO=$(shell ./os_detect)
 
-SUBDIRS:=domain_trans entrypoint execshare exectrace execute_no_trans \
+SUBDIRS:= domain_trans entrypoint execshare exectrace execute_no_trans \
 	fdreceive inherit link mkdir msg open ptrace readlink relabel rename \
 	rxdir sem setattr setnice shm sigkill stat sysctl task_create \
 	task_setnice task_setscheduler task_getscheduler task_getsid \
 	task_getpgid task_setpgid file ioctl capable_file capable_net \
 	capable_sys dyntrans dyntrace bounds nnp mmap unix_socket inet_socket \
-	overlay checkreqprot mqueue mac_admin
+	overlay checkreqprot mqueue mac_admin infiniband_pkey
 
 ifeq ($(shell grep -q cap_userns $(POLDEV)/include/support/all_perms.spt && echo true),true)
 ifneq ($(shell ./kvercmp $$(uname -r) 4.7),-1)
tests/infiniband_pkey/Makefile new file +7 -0
new file mode 100644
index 0000000..60f0d24
@@ -0,0 +1,7 @@
+TARGETS=create_modify_qp
+
+LDLIBS+= -libverbs
+
+all: $(TARGETS)
+clean:
+	rm -f $(TARGETS)
tests/infiniband_pkey/create_modify_qp.c new file +136 -0

136 lines not on this page · raw message

tests/infiniband_pkey/ibpkey_test.conf new file +18 -0
new file mode 100644
index 0000000..59f738d
@@ -0,0 +1,18 @@
+# Enable(1)/Disable these tests
+SELINUX_INFINIBAND_PKEY_TEST=0
+
+# Infiniband device to use.
+SELINUX_INFINIBAND_PKEY_TEST_DEV=mlx5_3
+
+# Physical port on the device to use.
+SELINUX_INFINIBAND_PKEY_TEST_PORT=1
+
+# CSV list of pkey table indexes containing labeled PKeys
+# These will not be allowed. 
+SELINUX_INFINIBAND_TEST_LABELED_PKEYS=
+
+# CSV list of pkey table indexes containing unlabelde PKeys
+# This will be allowed, then temporarily labeled to see that
+# they are disallowed.
+SELINUX_INFINIBAND_TEST_UNLABELED_PKEYS=0
+
tests/infiniband_pkey/test new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.12.2
#2 lore raw

PATCH v2 2/2 selinux-testsuite: Infiniband endport tests

In reply to Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband hardware, and if they do the device names can vary. There is a configuration file for enabling the tests and setting environment specific configurations. If the tests are disabled they always show as passed.

A special test application was unnecessary, a standard diagnostic application is used instead. This required a change to the make file to avoid trying to build an application in the new subdir.

---
v1:
- Synchronize interface names with refpolicy changes.
- Allowed access to unlabeled pkeys vs default pkey, default pkey is no longer labeled in the refpolicy.

v2:
Stephen Smalley:
- Use a stub makefile instead of a SUBDIRS_NO_MAKE directive.
- Use ifdefs around corenet_ib* interfaces.
- Only build the test_ibpendport.te file if the infiniband_endport class is available.
- use corecmd_bin_entry_type intefrace instead of allow ... bin_t:

---
 README                                       |  7 +++-
 policy/Makefile                              |  4 +++
 policy/test_ibendport.te                     | 40 +++++++++++++++++++++++
 tests/Makefile                               |  2 +-
 tests/infiniband_endport/Makefile            |  2 ++
 tests/infiniband_endport/ibendport_test.conf | 14 ++++++++
 tests/infiniband_endport/test                | 49 ++++++++++++++++++++++++++++
 tests/infiniband_pkey/test                   |  0
 8 files changed, 116 insertions(+), 2 deletions(-)
 create mode 100644 policy/test_ibendport.te
 create mode 100644 tests/infiniband_endport/Makefile
 create mode 100644 tests/infiniband_endport/ibendport_test.conf
 create mode 100755 tests/infiniband_endport/test
 mode change 100644 => 100755 tests/infiniband_pkey/test
README +6 -1
index a4c8ebb..de50eb4 100644
@@ -201,7 +201,12 @@ INFINIBAND TESTS
 ----------------
 Because running Infiniband tests requires specialized hardware you must
 set up a configuration file for these tests. The tests are disabled by
-default.  See comments in the configuration file for info.
+default.  See comments in the configuration file for info. The endport
+tests use smpquery, for Fedora it's provided by the infiniband-diags
+package.
 
 Infiniband PKey test conf file:
 tests/infiniband_pkey/ibpkey_test.conf
+
+Infiniband Endport test conf file:
+tests/infiniband_endport/ibendport_test.conf
policy/Makefile +4 -0
index 46c9fb5..c062009 100644
@@ -49,6 +49,10 @@ ifeq ($(shell grep -q getrlimit $(POLDEV)/include/support/all_perms.spt && echo
 TARGETS += test_prlimit.te
 endif
 
+ifeq ($(shell grep -q infiniband_endport $(POLDEV)/include/support/all_perms.spt && echo true),true)
+TARGETS += test_ibendport.te
+endif
+
 ifeq ($(shell grep -q all_file_perms.*map $(POLDEV)/include/support/all_perms.spt && echo true),true)
 export M4PARAM = -Dmap_permission_defined
 endif
policy/test_ibendport.te new file +40 -0
new file mode 100644
index 0000000..2a02c57
@@ -0,0 +1,40 @@
+#################################
+#
+# Policy for testing Infiniband Pkey access.
+#
+
+gen_require(`
+	type bin_t;
+	type infiniband_mgmt_device_t;
+')
+
+attribute ibendportdomain;
+
+# Domain for process.
+type test_ibendport_manage_subnet_t;
+domain_type(test_ibendport_manage_subnet_t)
+unconfined_runs_test(test_ibendport_manage_subnet_t)
+typeattribute test_ibendport_manage_subnet_t testdomain;
+typeattribute test_ibendport_manage_subnet_t ibendportdomain;
+
+type test_ibendport_t;
+ifdef(`corenet_ib_endport',`
+corenet_ib_endport(test_ibendport_t)
+')
+
+dev_rw_infiniband_dev(test_ibendport_manage_subnet_t)
+dev_rw_sysfs(test_ibendport_manage_subnet_t)
+
+corecmd_bin_entry_type(test_ibendport_manage_subnet_t)
+
+allow test_ibendport_manage_subnet_t infiniband_mgmt_device_t:chr_file { read write open ioctl};
+
+ifdef(`corenet_ib_access_unlabeled_pkeys',`
+corenet_ib_access_unlabeled_pkeys(test_ibendport_manage_subnet_t)
+')
+
+allow test_ibendport_manage_subnet_t test_ibendport_t:infiniband_endport manage_subnet;
+
+# Allow all of these domains to be entered from the sysadm domain.
+miscfiles_domain_entry_test_files(ibendportdomain)
+userdom_sysadm_entry_spec_domtrans_to(ibendportdomain)
tests/Makefile +1 -1
index 7dfe2a8..369b678 100644
@@ -10,7 +10,7 @@ SUBDIRS:= domain_trans entrypoint execshare exectrace execute_no_trans \
 	task_setnice task_setscheduler task_getscheduler task_getsid \
 	task_getpgid task_setpgid file ioctl capable_file capable_net \
 	capable_sys dyntrans dyntrace bounds nnp mmap unix_socket inet_socket \
-	overlay checkreqprot mqueue mac_admin infiniband_pkey
+	overlay checkreqprot mqueue mac_admin infiniband_pkey infiniband_endport
 
 ifeq ($(shell grep -q cap_userns $(POLDEV)/include/support/all_perms.spt && echo true),true)
 ifneq ($(shell ./kvercmp $$(uname -r) 4.7),-1)
tests/infiniband_endport/Makefile new file +2 -0
new file mode 100644
index 0000000..e7c006f
@@ -0,0 +1,2 @@
+all:
+clean:
tests/infiniband_endport/ibendport_test.conf new file +14 -0
new file mode 100644
index 0000000..601b290
@@ -0,0 +1,14 @@
+# Enable(1)/Disable these tests.
+SELINUX_INFINIBAND_ENDPORT_TEST=0
+
+# Device/port pair that should allow access.
+# The test uses semanage to allow, because
+# ibendports are all unlabeled by default
+# the reference policy. This allows using
+# the same device and port for both the pass
+# and fail testing as well.
+SELINUX_INFINIBAND_ENDPORT_TEST_ALLOWED=mlx5_3 1
+
+# Device/port pairs that should deny access.
+SELINUX_INFINIBAND_ENDPORT_TEST_DENIED=mlx5_2 1
+
tests/infiniband_endport/test new file +49 -0

49 lines not on this page · raw message

tests/infiniband_pkey/test +0 -0
old mode 100644
new mode 100755
Signature · 1 line
2.12.2
#3 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

tests/infiniband_pkey/test

Quoted 251 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband hardware, and if they do the device names can vary.  There is a configuration file for enabling the tests and setting environment specific configurations.  If the tests are disabled they always show as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead.  This required a change to the make file to avoid trying to build an application in the new subdir.

---
v1:
- Synchronize interface names with refpolicy changes.
- Allowed access to unlabeled pkeys vs default pkey, default pkey is no
longer labeled in the refpolicy.

v2:
Stephen Smalley:
- Use a stub makefile instead of a SUBDIRS_NO_MAKE directive.
- Use ifdefs around corenet_ib* interfaces.
- Only build the test_ibpendport.te file if the infiniband_endport class
is available.
- use corecmd_bin_entry_type intefrace instead of allow ... bin_t:
---
 README                                       |  7 +++- policy/Makefile                              |  4 +++ policy/test_ibendport.te                     | 40
+++++++++++++++++++++++
 tests/Makefile                               |  2 +- tests/infiniband_endport/Makefile            |  2 ++ tests/infiniband_endport/ibendport_test.conf | 14 ++++++++ tests/infiniband_endport/test                | 49
++++++++++++++++++++++++++++
 tests/infiniband_pkey/test                   |  0

 8 files changed, 116 insertions(+), 2 deletions(-)

 create mode 100644 policy/test_ibendport.te
 create mode 100644 tests/infiniband_endport/Makefile create mode 100644 tests/infiniband_endport/ibendport_test.conf create mode 100755 tests/infiniband_endport/test
 mode change 100644 => 100755 tests/infiniband_pkey/test

README +0 -0
index a4c8ebb..de50eb4 100644
@@ -201,7 +201,12 @@ INFINIBAND TESTS

 ----------------
 Because running Infiniband tests requires specialized hardware you must
 set up a configuration file for these tests. The tests are disabled by

README +1 -1
-default.  See comments in the configuration file for info.
+default.  See comments in the configuration file for info. The

endport

README +2 -0
+tests use smpquery, for Fedora it's provided by the infiniband-diags
+package.


 Infiniband PKey test conf file:
 tests/infiniband_pkey/ibpkey_test.conf

README +3 -0
+
+Infiniband Endport test conf file:
+tests/infiniband_endport/ibendport_test.conf
policy/Makefile +0 -0
index 46c9fb5..c062009 100644
@@ -49,6 +49,10 @@ ifeq ($(shell grep -q getrlimit

$(POLDEV)/include/support/all_perms.spt && echo TARGETS += test_prlimit.te
 endif

+ifeq ($(shell grep -q infiniband_endport $(POLDEV)/include/support/all_perms.spt && echo true),true)

policy/Makefile +3 -0
+TARGETS += test_ibendport.te
+endif
+

 ifeq ($(shell grep -q all_file_perms.*map $(POLDEV)/include/support/all_perms.spt && echo true),true) export M4PARAM = -Dmap_permission_defined
 endif

policy/test_ibendport.te new file +30 -0
new file mode 100644
index 0000000..2a02c57
@@ -0,0 +1,40 @@
+#################################
+#
+# Policy for testing Infiniband Pkey access.
+#
+
+gen_require(`
+	type bin_t;
+	type infiniband_mgmt_device_t;
+')
+
+attribute ibendportdomain;
+
+# Domain for process.
+type test_ibendport_manage_subnet_t;
+domain_type(test_ibendport_manage_subnet_t)
+unconfined_runs_test(test_ibendport_manage_subnet_t)
+typeattribute test_ibendport_manage_subnet_t testdomain;
+typeattribute test_ibendport_manage_subnet_t ibendportdomain;
+
+type test_ibendport_t;
+ifdef(`corenet_ib_endport',`
+corenet_ib_endport(test_ibendport_t)
+')
+
+dev_rw_infiniband_dev(test_ibendport_manage_subnet_t)
+dev_rw_sysfs(test_ibendport_manage_subnet_t)
+
+corecmd_bin_entry_type(test_ibendport_manage_subnet_t)
+
+allow test_ibendport_manage_subnet_t

infiniband_mgmt_device_t:chr_file { read write open ioctl};

policy/test_ibendport.te new file +6 -0
+
+ifdef(`corenet_ib_access_unlabeled_pkeys',`
+corenet_ib_access_unlabeled_pkeys(test_ibendport_manage_subnet_t)
+')
+
+allow test_ibendport_manage_subnet_t

test_ibendport_t:infiniband_endport manage_subnet;

policy/test_ibendport.te new file +4 -0
+
+# Allow all of these domains to be entered from the sysadm domain.
+miscfiles_domain_entry_test_files(ibendportdomain)
+userdom_sysadm_entry_spec_domtrans_to(ibendportdomain)
tests/Makefile +0 -0
index 7dfe2a8..369b678 100644
@@ -10,7 +10,7 @@ SUBDIRS:= domain_trans entrypoint execshare
 exectrace execute_no_trans \

  task_setnice task_setscheduler task_getscheduler task_getsid \
  task_getpgid task_setpgid file ioctl capable_file capable_net \
  capable_sys dyntrans dyntrace bounds nnp mmap unix_socket inet_socket \

tests/Makefile +1 -1
-	overlay checkreqprot mqueue mac_admin infiniband_pkey
+	overlay checkreqprot mqueue mac_admin infiniband_pkey

infiniband_endport

 ifeq ($(shell grep -q cap_userns $(POLDEV)/include/support/all_perms.spt && echo true),true) ifneq ($(shell ./kvercmp $$(uname -r) 4.7),-1)

tests/infiniband_endport/Makefile new file +2 -0
new file mode 100644
index 0000000..e7c006f
@@ -0,0 +1,2 @@
+all:
+clean:
tests/infiniband_endport/ibendport_test.conf new file +14 -0
new file mode 100644
index 0000000..601b290
@@ -0,0 +1,14 @@
+# Enable(1)/Disable these tests.
+SELINUX_INFINIBAND_ENDPORT_TEST=0
+
+# Device/port pair that should allow access.
+# The test uses semanage to allow, because
+# ibendports are all unlabeled by default
+# the reference policy. This allows using
+# the same device and port for both the pass
+# and fail testing as well.
+SELINUX_INFINIBAND_ENDPORT_TEST_ALLOWED=mlx5_3 1
+
+# Device/port pairs that should deny access.
+SELINUX_INFINIBAND_ENDPORT_TEST_DENIED=mlx5_2 1
+
tests/infiniband_endport/test new file +20 -0
new file mode 100755
index 0000000..b4e553d
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use Test;
+
+BEGIN { plan tests => 2}
+
+$basedir = $0;  $basedir =~ s|(.*)/[^/]*|$1|;
+
+my %conf;
+my $confpath = $basedir."/ibendport_test.conf";
+open($f, $confpath) or die ("Couldn't open ibtest.conf");
+while($r = <$f>) {
+	if ($r =~ /^\s*#/ || $r =~ /^\s*$/) { next; }
+	chomp $r;
+	($k,$v) = split(/=/, $r);
+	$conf{$k} = $v;
+}
+
+if ($conf{SELINUX_INFINIBAND_ENDPORT_TEST} eq 1) {
+	@allowed_device_port = split(/,/,

$conf{SELINUX_INFINIBAND_ENDPORT_TEST_ALLOWED});

tests/infiniband_endport/test new file +1 -0
+	@denied_device_port = split(/,/,

$conf{SELINUX_INFINIBAND_ENDPORT_TEST_DENIED});

tests/infiniband_endport/test new file +5 -0
+
+	foreach (@allowed_device_port) {
+		@dev_port_pair= split(/ /, $_);
+
+		system "semanage ibendport -a -t test_ibendport_t -z

$_ 2>/dev/null";

tests/infiniband_endport/test new file +1 -0
+		$result = system "runcon -t

test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";

tests/infiniband_endport/test new file +1 -0
+		system "semanage ibendport -d -t test_ibendport_t -z

$_ 2>/dev/null";

tests/infiniband_endport/test new file +9 -0
+		if($result ne 0) {
+			last;
+		}
+	}
+	ok($result, 0);
+
+        foreach (@denied_device_port) {
+	        @dev_port_pair= split(/ /, $_);
+	        $result = system "runcon -t

test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";

tests/infiniband_endport/test new file +12 -0
+
+		if ($result>>8 eq 0) {
+			last;
+		}
+	}
+
+	ok(int($result>>8) ne 0);
+} else {
+	ok(1);
+	ok(1);
+}
+exit;
tests/infiniband_pkey/test +0 -0
old mode 100644
new mode 100755

Not a big deal, but it seems odd that this mode change wasn't just squashed into the first patch.

Otherwise, it looks ok to me, but I don't have hardware to test it on. Did you confirm that when you run the tests, you get the expected avc denials in the audit logs? Also, did you confirm that if you manually run the tests in permissive mode, that the tests you expect to fail do so (and the rest do not)?

#4 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 255 lines · Stephen Smalley

tests/infiniband_pkey/test

Quoted 251 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband hardware, and if they do the device names can vary. There is a configuration file for enabling the tests and setting environment specific configurations. If the tests are disabled they always show as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead. This required a change to the make file to avoid trying to build an application in the new subdir.

---
v1:
- Synchronize interface names with refpolicy changes.
- Allowed access to unlabeled pkeys vs default pkey, default pkey is no
longer labeled in the refpolicy.

v2:
Stephen Smalley:
- Use a stub makefile instead of a SUBDIRS_NO_MAKE directive.
- Use ifdefs around corenet_ib* interfaces.
- Only build the test_ibpendport.te file if the infiniband_endport class
is available.
- use corecmd_bin_entry_type intefrace instead of allow ... bin_t:

---
 README                                       |  7 +++-
 policy/Makefile                              |  4 +++
 policy/test_ibendport.te                     | 40
+++++++++++++++++++++++
 tests/Makefile                               |  2 +-
 tests/infiniband_endport/Makefile            |  2 ++
 tests/infiniband_endport/ibendport_test.conf | 14 ++++++++
 tests/infiniband_endport/test                | 49
++++++++++++++++++++++++++++
 tests/infiniband_pkey/test                   |  0
 8 files changed, 116 insertions(+), 2 deletions(-)
 create mode 100644 policy/test_ibendport.te
 create mode 100644 tests/infiniband_endport/Makefile
 create mode 100644 tests/infiniband_endport/ibendport_test.conf
 create mode 100755 tests/infiniband_endport/test
 mode change 100644 => 100755 tests/infiniband_pkey/test
README +0 -0
index a4c8ebb..de50eb4 100644
@@ -201,7 +201,12 @@ INFINIBAND TESTS
 ----------------
 Because running Infiniband tests requires specialized hardware you

must
set up a configuration file for these tests. The tests are disabled
by

README +1 -1
-default.  See comments in the configuration file for info.
+default.  See comments in the configuration file for info. The

endport

README +5 -0
+tests use smpquery, for Fedora it's provided by the infiniband-diags
+package.
 
 Infiniband PKey test conf file:
 tests/infiniband_pkey/ibpkey_test.conf
+
+Infiniband Endport test conf file:
+tests/infiniband_endport/ibendport_test.conf
policy/Makefile +0 -0
index 46c9fb5..c062009 100644
@@ -49,6 +49,10 @@ ifeq ($(shell grep -q getrlimit

$(POLDEV)/include/support/all_perms.spt && echo
TARGETS += test_prlimit.te
endif

+ifeq ($(shell grep -q infiniband_endport $(POLDEV)/include/support/all_perms.spt && echo true),true)

policy/Makefile +3 -0
+TARGETS += test_ibendport.te
+endif
+
 ifeq ($(shell grep -q all_file_perms.*map

$(POLDEV)/include/support/all_perms.spt && echo true),true)
export M4PARAM = -Dmap_permission_defined
endif

policy/test_ibendport.te new file +30 -0
new file mode 100644
index 0000000..2a02c57
@@ -0,0 +1,40 @@
+#################################
+#
+# Policy for testing Infiniband Pkey access.
+#
+
+gen_require(`
+	type bin_t;
+	type infiniband_mgmt_device_t;
+')
+
+attribute ibendportdomain;
+
+# Domain for process.
+type test_ibendport_manage_subnet_t;
+domain_type(test_ibendport_manage_subnet_t)
+unconfined_runs_test(test_ibendport_manage_subnet_t)
+typeattribute test_ibendport_manage_subnet_t testdomain;
+typeattribute test_ibendport_manage_subnet_t ibendportdomain;
+
+type test_ibendport_t;
+ifdef(`corenet_ib_endport',`
+corenet_ib_endport(test_ibendport_t)
+')
+
+dev_rw_infiniband_dev(test_ibendport_manage_subnet_t)
+dev_rw_sysfs(test_ibendport_manage_subnet_t)
+
+corecmd_bin_entry_type(test_ibendport_manage_subnet_t)
+
+allow test_ibendport_manage_subnet_t

infiniband_mgmt_device_t:chr_file { read write open ioctl};

policy/test_ibendport.te new file +6 -0
+
+ifdef(`corenet_ib_access_unlabeled_pkeys',`
+corenet_ib_access_unlabeled_pkeys(test_ibendport_manage_subnet_t)
+')
+
+allow test_ibendport_manage_subnet_t

test_ibendport_t:infiniband_endport manage_subnet;

policy/test_ibendport.te new file +4 -0
+
+# Allow all of these domains to be entered from the sysadm domain.
+miscfiles_domain_entry_test_files(ibendportdomain)
+userdom_sysadm_entry_spec_domtrans_to(ibendportdomain)
tests/Makefile +1 -1
index 7dfe2a8..369b678 100644
@@ -10,7 +10,7 @@ SUBDIRS:= domain_trans entrypoint execshare
 exectrace execute_no_trans \
 	task_setnice task_setscheduler task_getscheduler task_getsid
 \
 	task_getpgid task_setpgid file ioctl capable_file
 capable_net \
 	capable_sys dyntrans dyntrace bounds nnp mmap unix_socket
 inet_socket \
-	overlay checkreqprot mqueue mac_admin infiniband_pkey
+	overlay checkreqprot mqueue mac_admin infiniband_pkey

infiniband_endport

ifeq ($(shell grep -q cap_userns
$(POLDEV)/include/support/all_perms.spt && echo true),true)
ifneq ($(shell ./kvercmp $$(uname -r) 4.7),-1)

tests/infiniband_endport/Makefile new file +2 -0
new file mode 100644
index 0000000..e7c006f
@@ -0,0 +1,2 @@
+all:
+clean:
tests/infiniband_endport/ibendport_test.conf new file +14 -0
new file mode 100644
index 0000000..601b290
@@ -0,0 +1,14 @@
+# Enable(1)/Disable these tests.
+SELINUX_INFINIBAND_ENDPORT_TEST=0
+
+# Device/port pair that should allow access.
+# The test uses semanage to allow, because
+# ibendports are all unlabeled by default
+# the reference policy. This allows using
+# the same device and port for both the pass
+# and fail testing as well.
+SELINUX_INFINIBAND_ENDPORT_TEST_ALLOWED=mlx5_3 1
+
+# Device/port pairs that should deny access.
+SELINUX_INFINIBAND_ENDPORT_TEST_DENIED=mlx5_2 1
+
tests/infiniband_endport/test new file +20 -0
new file mode 100755
index 0000000..b4e553d
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use Test;
+
+BEGIN { plan tests => 2}
+
+$basedir = $0;  $basedir =~ s|(.*)/[^/]*|$1|;
+
+my %conf;
+my $confpath = $basedir."/ibendport_test.conf";
+open($f, $confpath) or die ("Couldn't open ibtest.conf");
+while($r = <$f>) {
+	if ($r =~ /^\s*#/ || $r =~ /^\s*$/) { next; }
+	chomp $r;
+	($k,$v) = split(/=/, $r);
+	$conf{$k} = $v;
+}
+
+if ($conf{SELINUX_INFINIBAND_ENDPORT_TEST} eq 1) {
+	@allowed_device_port = split(/,/,

$conf{SELINUX_INFINIBAND_ENDPORT_TEST_ALLOWED});

tests/infiniband_endport/test new file +1 -0
+	@denied_device_port = split(/,/,

$conf{SELINUX_INFINIBAND_ENDPORT_TEST_DENIED});

tests/infiniband_endport/test new file +5 -0
+
+	foreach (@allowed_device_port) {
+		@dev_port_pair= split(/ /, $_);
+
+		system "semanage ibendport -a -t test_ibendport_t -z

$_ 2>/dev/null";

tests/infiniband_endport/test new file +1 -0
+		$result = system "runcon -t

test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";

tests/infiniband_endport/test new file +1 -0
+		system "semanage ibendport -d -t test_ibendport_t -z

$_ 2>/dev/null";

tests/infiniband_endport/test new file +9 -0
+		if($result ne 0) {
+			last;
+		}
+	}
+	ok($result, 0);
+
+        foreach (@denied_device_port) {
+	        @dev_port_pair= split(/ /, $_);
+	        $result = system "runcon -t

test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";

tests/infiniband_endport/test new file +12 -0
+
+		if ($result>>8 eq 0) {
+			last;
+		}
+	}
+
+	ok(int($result>>8) ne 0);
+} else {
+	ok(1);
+	ok(1);
+}
+exit;
tests/infiniband_pkey/test +0 -0
old mode 100644
new mode 100755

Not a big deal, but it seems odd that this mode change wasn't just squashed into the first patch.

Quoted 7 lines

Otherwise, it looks ok to me, but I don't have hardware to test it on. Did you confirm that when you run the tests, you get the expected avc denials in the audit logs? Also, did you confirm that if you manually run the tests in permissive mode, that the tests you expect to fail do so (and the rest do not)?

I'm not sure what happened with the mode there. I didn't change it manually. I can clean it up if you want.

Regarding testing the test. Yes, I did make sure they fail as expected when in permissive mode. Also I changed setting in the configuration files to make sure all cases fail when they should where that was possible.

#5 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 285 lines · Daniel Jurgens
Quoted 272 lines · Stephen Smalley

tests/infiniband_pkey/test

Quoted 267 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband
hardware, and if they do the device names can vary.  There is a configuration file for enabling the tests and setting environment specific configurations.  If the tests are disabled they always show
as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead.  This required a change to the make file
to avoid trying to build an application in the new subdir.

---
v1:
- Synchronize interface names with refpolicy changes.
- Allowed access to unlabeled pkeys vs default pkey, default pkey is
no
longer labeled in the refpolicy.

v2:
Stephen Smalley:
- Use a stub makefile instead of a SUBDIRS_NO_MAKE directive.
- Use ifdefs around corenet_ib* interfaces.
- Only build the test_ibpendport.te file if the infiniband_endport
class
is available.
- use corecmd_bin_entry_type intefrace instead of allow ... bin_t:
---
 README                                       |  7 +++- policy/Makefile                              |  4 +++ policy/test_ibendport.te                     | 40
+++++++++++++++++++++++
 tests/Makefile                               |  2 +- tests/infiniband_endport/Makefile            |  2 ++ tests/infiniband_endport/ibendport_test.conf | 14 ++++++++ tests/infiniband_endport/test                | 49
++++++++++++++++++++++++++++
 tests/infiniband_pkey/test                   |  0

 8 files changed, 116 insertions(+), 2 deletions(-)

 create mode 100644 policy/test_ibendport.te
 create mode 100644 tests/infiniband_endport/Makefile create mode 100644 tests/infiniband_endport/ibendport_test.conf create mode 100755 tests/infiniband_endport/test
 mode change 100644 => 100755 tests/infiniband_pkey/test

README +0 -0
index a4c8ebb..de50eb4 100644
@@ -201,7 +201,12 @@ INFINIBAND TESTS

 ----------------
 Because running Infiniband tests requires specialized hardware you
must
 set up a configuration file for these tests. The tests are disabled
by

README +1 -1
-default.  See comments in the configuration file for info.
+default.  See comments in the configuration file for info. The

endport
+tests use smpquery, for Fedora it's provided by the infiniband- diags
+package.

 Infiniband PKey test conf file:
 tests/infiniband_pkey/ibpkey_test.conf

README +3 -0
+
+Infiniband Endport test conf file:
+tests/infiniband_endport/ibendport_test.conf
policy/Makefile +0 -0
index 46c9fb5..c062009 100644
@@ -49,6 +49,10 @@ ifeq ($(shell grep -q getrlimit

$(POLDEV)/include/support/all_perms.spt && echo TARGETS += test_prlimit.te
 endif

+ifeq ($(shell grep -q infiniband_endport $(POLDEV)/include/support/all_perms.spt && echo true),true)

policy/Makefile +3 -0
+TARGETS += test_ibendport.te
+endif
+

 ifeq ($(shell grep -q all_file_perms.*map $(POLDEV)/include/support/all_perms.spt && echo true),true) export M4PARAM = -Dmap_permission_defined
 endif

policy/test_ibendport.te new file +30 -0
new file mode 100644
index 0000000..2a02c57
@@ -0,0 +1,40 @@
+#################################
+#
+# Policy for testing Infiniband Pkey access.
+#
+
+gen_require(`
+	type bin_t;
+	type infiniband_mgmt_device_t;
+')
+
+attribute ibendportdomain;
+
+# Domain for process.
+type test_ibendport_manage_subnet_t;
+domain_type(test_ibendport_manage_subnet_t)
+unconfined_runs_test(test_ibendport_manage_subnet_t)
+typeattribute test_ibendport_manage_subnet_t testdomain;
+typeattribute test_ibendport_manage_subnet_t ibendportdomain;
+
+type test_ibendport_t;
+ifdef(`corenet_ib_endport',`
+corenet_ib_endport(test_ibendport_t)
+')
+
+dev_rw_infiniband_dev(test_ibendport_manage_subnet_t)
+dev_rw_sysfs(test_ibendport_manage_subnet_t)
+
+corecmd_bin_entry_type(test_ibendport_manage_subnet_t)
+
+allow test_ibendport_manage_subnet_t

infiniband_mgmt_device_t:chr_file { read write open ioctl};

policy/test_ibendport.te new file +3 -0
+
+ifdef(`corenet_ib_access_unlabeled_pkeys',`
+corenet_ib_access_unlabeled_pkeys(test_ibendport_manage_subnet_t

)
+')

policy/test_ibendport.te new file +2 -0
+
+allow test_ibendport_manage_subnet_t

test_ibendport_t:infiniband_endport manage_subnet;

policy/test_ibendport.te new file +2 -0
+
+# Allow all of these domains to be entered from the sysadm

domain.

policy/test_ibendport.te new file +2 -0
+miscfiles_domain_entry_test_files(ibendportdomain)
+userdom_sysadm_entry_spec_domtrans_to(ibendportdomain)
tests/Makefile +0 -0
index 7dfe2a8..369b678 100644
@@ -10,7 +10,7 @@ SUBDIRS:= domain_trans entrypoint execshare
 exectrace execute_no_trans \

  task_setnice task_setscheduler task_getscheduler task_getsid
\
  task_getpgid task_setpgid file ioctl capable_file capable_net \
  capable_sys dyntrans dyntrace bounds nnp mmap unix_socket
inet_socket \

tests/Makefile +1 -1
-	overlay checkreqprot mqueue mac_admin infiniband_pkey
+	overlay checkreqprot mqueue mac_admin infiniband_pkey

infiniband_endport

 ifeq ($(shell grep -q cap_userns $(POLDEV)/include/support/all_perms.spt && echo true),true) ifneq ($(shell ./kvercmp $$(uname -r) 4.7),-1)

tests/infiniband_endport/Makefile new file +2 -0
new file mode 100644
index 0000000..e7c006f
@@ -0,0 +1,2 @@
+all:
+clean:
tests/infiniband_endport/ibendport_test.conf new file +14 -0
new file mode 100644
index 0000000..601b290
@@ -0,0 +1,14 @@
+# Enable(1)/Disable these tests.
+SELINUX_INFINIBAND_ENDPORT_TEST=0
+
+# Device/port pair that should allow access.
+# The test uses semanage to allow, because
+# ibendports are all unlabeled by default
+# the reference policy. This allows using
+# the same device and port for both the pass
+# and fail testing as well.
+SELINUX_INFINIBAND_ENDPORT_TEST_ALLOWED=mlx5_3 1
+
+# Device/port pairs that should deny access.
+SELINUX_INFINIBAND_ENDPORT_TEST_DENIED=mlx5_2 1
+
tests/infiniband_endport/test new file +20 -0
new file mode 100755
index 0000000..b4e553d
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use Test;
+
+BEGIN { plan tests => 2}
+
+$basedir = $0;  $basedir =~ s|(.*)/[^/]*|$1|;
+
+my %conf;
+my $confpath = $basedir."/ibendport_test.conf";
+open($f, $confpath) or die ("Couldn't open ibtest.conf");
+while($r = <$f>) {
+	if ($r =~ /^\s*#/ || $r =~ /^\s*$/) { next; }
+	chomp $r;
+	($k,$v) = split(/=/, $r);
+	$conf{$k} = $v;
+}
+
+if ($conf{SELINUX_INFINIBAND_ENDPORT_TEST} eq 1) {
+	@allowed_device_port = split(/,/,

$conf{SELINUX_INFINIBAND_ENDPORT_TEST_ALLOWED});

tests/infiniband_endport/test new file +1 -0
+	@denied_device_port = split(/,/,

$conf{SELINUX_INFINIBAND_ENDPORT_TEST_DENIED});

tests/infiniband_endport/test new file +5 -0
+
+	foreach (@allowed_device_port) {
+		@dev_port_pair= split(/ /, $_);
+
+		system "semanage ibendport -a -t

test_ibendport_t -z
$_ 2>/dev/null";

tests/infiniband_endport/test new file +1 -0
+		$result = system "runcon -t

test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";

tests/infiniband_endport/test new file +1 -0
+		system "semanage ibendport -d -t

test_ibendport_t -z
$_ 2>/dev/null";

tests/infiniband_endport/test new file +9 -0
+		if($result ne 0) {
+			last;
+		}
+	}
+	ok($result, 0);
+
+        foreach (@denied_device_port) {
+	        @dev_port_pair= split(/ /, $_);
+	        $result = system "runcon -t

test_ibendport_manage_subnet_t smpquery PKeyTable -C $dev_port_pair[0] -P $dev_port_pair[1] -D 1 2>/dev/null";

tests/infiniband_endport/test new file +12 -0
+
+		if ($result>>8 eq 0) {
+			last;
+		}
+	}
+
+	ok(int($result>>8) ne 0);
+} else {
+	ok(1);
+	ok(1);
+}
+exit;
tests/infiniband_pkey/test +0 -0
old mode 100644
new mode 100755

Not a big deal, but it seems odd that this mode change wasn't just squashed into the first patch.

Quoted 11 lines

Otherwise, it looks ok to me, but I don't have hardware to test it on.
Did you confirm that when you run the tests, you get the expected avc
denials in the audit logs?  Also, did you confirm that if you manually
run the tests in permissive mode, that the tests you expect to fail do
so (and the rest do not)?

Quoted 2 lines

I'm not sure what happened with the mode there.  I didn't change it manually.  I can clean it up if you want.

Looks like tests/Makefile does a chmod +x */test.
I wouldn't bother re-spinning unless Paul has other comments.

Quoted 4 lines

Regarding testing the test. Yes, I did make sure they fail as expected when in permissive mode.  Also I changed setting in the configuration files to make sure all cases fail when they should where that was possible.

And avc: denied messages are as expected?

#6 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 25 lines · Stephen Smalley
Quoted 22 lines · Daniel Jurgens
Quoted 10 lines · Stephen Smalley

tests/infiniband_pkey/test

Quoted 6 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

tests/infiniband_pkey/test +0 -0
old mode 100644
new mode 100755

Not a big deal, but it seems odd that this mode change wasn't just squashed into the first patch.

Quoted 11 lines

Otherwise, it looks ok to me, but I don't have hardware to test it on.
Did you confirm that when you run the tests, you get the expected avc
denials in the audit logs? Also, did you confirm that if you manually
run the tests in permissive mode, that the tests you expect to fail do
so (and the rest do not)?

Quoted 2 lines

I'm not sure what happened with the mode there. I didn't change it manually. I can clean it up if you want.

Quoted 9 lines

Looks like tests/Makefile does a chmod +x */test.
I wouldn't bother re-spinning unless Paul has other comments.

Quoted 4 lines

Regarding testing the test. Yes, I did make sure they fail as expected when in permissive mode. Also I changed setting in the configuration files to make sure all cases fail when they should where that was possible.

And avc: denied messages are as expected?

Yes, here's a sample:

type=AVC msg=audit(1496161222.307:1584): avc: denied { manage_subnet } for pid=21976 comm="smpquery" device=mlx5_2 port_num=1 scontext=unconfined_u:unconfined_r:test_ibendport_manage_subnet_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s0 tclass=infiniband_endport permissive=0

maintainer
#7 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

In reply to Stephen Smalley
Quoted 20 lines · Stephen Smalley
Quoted 19 lines · Daniel Jurgens
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband
hardware, and if they do the device names can vary. There is a configuration file for enabling the tests and setting environment specific configurations. If the tests are disabled they always show
as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead. This required a change to the make file
to avoid trying to build an application in the new subdir.

...

Quoted 1 line

I wouldn't bother re-spinning unless Paul has other comments.

Nothing worthy of a respin.

Daniel, have you run these tests against the kernel, userspace, and policy code that has been merged? It would be nice to have a sanity check that something didn't break while we were merging everything.

[SIDE NOTE: This afternoon I noticed what I think may be a problem with my COPR kernel builds that affects the test suite, so YMMY at the moment.]

Signature · 2 lines
paul moore
www.paul-moore.com
#8 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 26 lines · Paul Moore
Quoted 20 lines · Stephen Smalley
Quoted 19 lines · Daniel Jurgens
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband
hardware, and if they do the device names can vary. There is a configuration file for enabling the tests and setting environment specific configurations. If the tests are disabled they always show
as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead. This required a change to the make file
to avoid trying to build an application in the new subdir.

...

Quoted 1 line

I wouldn't bother re-spinning unless Paul has other comments.

Nothing worthy of a respin.

Quoted 8 lines

Daniel, have you run these tests against the kernel, userspace, and policy code that has been merged? It would be nice to have a sanity check that something didn't break while we were merging everything.

[SIDE NOTE: This afternoon I noticed what I think may be a problem with my COPR kernel builds that affects the test suite, so YMMY at the moment.]

I ran them against the merged kernel and selinux code. But I used the same policy RPMs that I had been using, I didn't try to rebuild the RPMs against the new refpolicy.

#9 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 31 lines · Daniel Jurgens
Quoted 30 lines · Paul Moore
Quoted 20 lines · Stephen Smalley
Quoted 19 lines · Daniel Jurgens
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband
hardware, and if they do the device names can vary. There is a configuration file for enabling the tests and setting environment specific configurations. If the tests are disabled they always show
as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead. This required a change to the make file
to avoid trying to build an application in the new subdir.

...

Quoted 1 line

I wouldn't bother re-spinning unless Paul has other comments.

Nothing worthy of a respin.

Daniel, have you run these tests against the kernel, userspace, and policy code that has been merged? It would be nice to have a sanity check that something didn't break while we were merging everything.

Quoted 6 lines
Quoted 4 lines

[SIDE NOTE: This afternoon I noticed what I think may be a problem with my COPR kernel builds that affects the test suite, so YMMY at the moment.]

I ran them against the merged kernel and selinux code. But I used the same policy RPMs that I had been using, I didn't try to rebuild the RPMs against the new refpolicy.

Are these tests good to go? I haven't gotten any additional comments since v2.

maintainer
#10 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 32 lines · Daniel Jurgens
Quoted 31 lines · Daniel Jurgens
Quoted 30 lines · Paul Moore
Quoted 20 lines · Stephen Smalley
Quoted 19 lines · Daniel Jurgens
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband
hardware, and if they do the device names can vary. There is a configuration file for enabling the tests and setting environment specific configurations. If the tests are disabled they always show
as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead. This required a change to the make file
to avoid trying to build an application in the new subdir.

...

Quoted 1 line

I wouldn't bother re-spinning unless Paul has other comments.

Nothing worthy of a respin.

Daniel, have you run these tests against the kernel, userspace, and policy code that has been merged? It would be nice to have a sanity check that something didn't break while we were merging everything.

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

[SIDE NOTE: This afternoon I noticed what I think may be a problem with my COPR kernel builds that affects the test suite, so YMMY at the moment.]

I ran them against the merged kernel and selinux code. But I used the same policy RPMs that I had been using, I didn't try to rebuild the RPMs against the new refpolicy.

Are these tests good to go? I haven't gotten any additional comments since v2.

Yes, my apologies for not getting back to you sooner; I had hoped to talk to some of the IB folks at Red Hat to see if they could verify everything (or at least get access to a IB system so I could verify it) but I got wrapped in a few audit issues this week and didn't get to it.

I'll merge these patches later this afternoon.

Signature · 2 lines
paul moore
www.paul-moore.com
#11 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 39 lines · Paul Moore
Quoted 38 lines · Daniel Jurgens
Quoted 37 lines · Daniel Jurgens
Quoted 26 lines · Paul Moore
Quoted 20 lines · Stephen Smalley
Quoted 19 lines · Daniel Jurgens
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband
hardware, and if they do the device names can vary. There is a configuration file for enabling the tests and setting environment specific configurations. If the tests are disabled they always show
as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead. This required a change to the make file
to avoid trying to build an application in the new subdir.

...

Quoted 1 line

I wouldn't bother re-spinning unless Paul has other comments.

Nothing worthy of a respin.

Quoted 8 lines

Daniel, have you run these tests against the kernel, userspace, and policy code that has been merged? It would be nice to have a sanity check that something didn't break while we were merging everything.

[SIDE NOTE: This afternoon I noticed what I think may be a problem with my COPR kernel builds that affects the test suite, so YMMY at the moment.]

I ran them against the merged kernel and selinux code. But I used the same policy RPMs that I had been using, I didn't try to rebuild the RPMs against the new refpolicy.

Quoted 9 lines
Quoted 1 line

Are these tests good to go? I haven't gotten any additional comments since v2.

Yes, my apologies for not getting back to you sooner; I had hoped to talk to some of the IB folks at Red Hat to see if they could verify everything (or at least get access to a IB system so I could verify it) but I got wrapped in a few audit issues this week and didn't get to it.

I'll merge these patches later this afternoon.

No problem, just wanted to make sure I wasn't holding it up in anyway.

I recall you saying you do most of your testing in VMs on a laptop. But if you have a system with a free pci-e slot we can ship you an HCA if you'd like to be able to run these yourself.

maintainer
#12 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 47 lines · Daniel Jurgens
Quoted 46 lines · Paul Moore
Quoted 32 lines · Daniel Jurgens
Quoted 31 lines · Daniel Jurgens
Quoted 30 lines · Paul Moore
Quoted 20 lines · Stephen Smalley
Quoted 19 lines · Daniel Jurgens
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Dan Jurgens

From: Daniel Jurgens <[email protected]>

New tests for Infiniband endports. Most users do not have infiniband
hardware, and if they do the device names can vary. There is a configuration file for enabling the tests and setting environment specific configurations. If the tests are disabled they always show
as
passed.

A special test application was unnecessary, a standard diagnostic application is used instead. This required a change to the make file
to avoid trying to build an application in the new subdir.

...

Quoted 1 line

I wouldn't bother re-spinning unless Paul has other comments.

Nothing worthy of a respin.

Daniel, have you run these tests against the kernel, userspace, and policy code that has been merged? It would be nice to have a sanity check that something didn't break while we were merging everything.

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

[SIDE NOTE: This afternoon I noticed what I think may be a problem with my COPR kernel builds that affects the test suite, so YMMY at the moment.]

I ran them against the merged kernel and selinux code. But I used the same policy RPMs that I had been using, I didn't try to rebuild the RPMs against the new refpolicy.

Are these tests good to go? I haven't gotten any additional comments since v2.

Yes, my apologies for not getting back to you sooner; I had hoped to talk to some of the IB folks at Red Hat to see if they could verify everything (or at least get access to a IB system so I could verify it) but I got wrapped in a few audit issues this week and didn't get to it.

Quoted 3 lines
Quoted 2 lines

I'll merge these patches later this afternoon.

No problem, just wanted to make sure I wasn't holding it up in anyway.

Should be all set now, let me know if you notice any problems. I did add a separate third commit to munge the style/formatting (see previous emails); I didn't bother posting it to the list as it is just style changes, but in case anyone is curious, this is the commit:

commit 8e0339cef20d0356d3e115c31a133662e9562e65
Author: Paul Moore <[email protected]>
Date: Fri Jun 9 15:46:37 2017 -0400

infiniband: apply style corrections to the infiniband tests

Patch generated by './tools/check-syntax -f'.

Quoted 1 line

I recall you saying you do most of your testing in VMs on a laptop. But if you have a system with a free pci-e slot we can ship you an HCA if you'd like to be able to run these yourself.

Thank you for the offer, and yes I generally run the tests in a VM, however we've been working on getting something a bit more automated in place for upstream testing (more info on that once everything is sorted out).

Let me think about this a bit (and dust off my somewhat neglected testing hardware), I generally try to avoid getting tied to specific hardware, but it is necessary in this case, and I fear that this may be the easiest way to ensure it gets tested regularly.

Signature · 2 lines
paul moore
www.paul-moore.com
#13 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 23 lines · Paul Moore

On Fri, Jun 9, 2017 at 10:59 AM, Daniel Jurgens <[email protected]> wrote:

Should be all set now, let me know if you notice any problems. I did add a separate third commit to munge the style/formatting (see previous emails); I didn't bother posting it to the list as it is just style changes, but in case anyone is curious, this is the commit:

commit 8e0339cef20d0356d3e115c31a133662e9562e65
Author: Paul Moore <[email protected]>
Date: Fri Jun 9 15:46:37 2017 -0400

infiniband: apply style corrections to the infiniband tests

Patch generated by './tools/check-syntax -f'.

Quoted 1 line

I recall you saying you do most of your testing in VMs on a laptop. But if you have a system with a free pci-e slot we can ship you an HCA if you'd like to be able to run these yourself.

Thank you for the offer, and yes I generally run the tests in a VM, however we've been working on getting something a bit more automated in place for upstream testing (more info on that once everything is sorted out).

Quoted 5 lines

Let me think about this a bit (and dust off my somewhat neglected testing hardware), I generally try to avoid getting tied to specific hardware, but it is necessary in this case, and I fear that this may be the easiest way to ensure it gets tested regularly.

OK, just let me know if you want one. Once the feature works it's way back to mainstream kernel I'll add the tests to our automated regressions too. Thanks for all your help getting this whole thing through review!

How often does the fedora-selinux project switch the base refpolicy? It needs additions to the unconfined user role to allow access.

maintainer
#14 lore raw

Re: [PATCH v2 2/2] selinux-testsuite: Infiniband endport tests

Quoted 24 lines · Daniel Jurgens
Quoted 23 lines · Paul Moore

On Fri, Jun 9, 2017 at 10:59 AM, Daniel Jurgens <[email protected]> wrote:

Should be all set now, let me know if you notice any problems. I did add a separate third commit to munge the style/formatting (see previous emails); I didn't bother posting it to the list as it is just style changes, but in case anyone is curious, this is the commit:

commit 8e0339cef20d0356d3e115c31a133662e9562e65
Author: Paul Moore <[email protected]>
Date: Fri Jun 9 15:46:37 2017 -0400

infiniband: apply style corrections to the infiniband tests

Patch generated by './tools/check-syntax -f'.

Quoted 1 line

I recall you saying you do most of your testing in VMs on a laptop. But if you have a system with a free pci-e slot we can ship you an HCA if you'd like to be able to run these yourself.

Thank you for the offer, and yes I generally run the tests in a VM, however we've been working on getting something a bit more automated in place for upstream testing (more info on that once everything is sorted out).

Quoted 6 lines
Quoted 5 lines

Let me think about this a bit (and dust off my somewhat neglected testing hardware), I generally try to avoid getting tied to specific hardware, but it is necessary in this case, and I fear that this may be the easiest way to ensure it gets tested regularly.

OK, just let me know if you want one. Once the feature works it's way back to mainstream kernel I'll add the tests to our automated regressions too. Thanks for all your help getting this whole thing through review!

FWIW, this was in the pull request I sent up to James, you should see it arrive in Linus' tree during the upcoming merge window.

Quoted 1 line

How often does the fedora-selinux project switch the base refpolicy? It needs additions to the unconfined user role to allow access.

My apologies, I just realized I never answered this last question about Fedora ... the answer is the usual "it depends". I've added Lukas Vrabec to this email as he is in charge of the Fedora SELinux policy.

Signature · 2 lines
paul moore
www.paul-moore.com