Skip to contentSkip to conversation

tests/file: make the SIGIO tests work with CONFIG_LEGACY_TIOCSTI=n

PATCH In review Ondrej Mosnacek 2 participants 3 messages Mar 1, 2023 – Mar 3, 2023 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/file: make the SIGIO tests work with CONFIG_LEGACY_TIOCSTI=n

Adjust the test to temporarily set the dev.tty.legacy_tiocsti sysctl to 1 if it is 0 and re-enable the SIGIO tests.

---

The dev.tty.legacy_tiocsti sysctl fix is now in mainline as commit f1aa2eb5ea05 ("sysctl: fix proc_dobool() usability"), so we can use it to re-enable the SIGIO tests.

Passes the CI with the latest kernel-secnext kernel.

 tests/file/test | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
tests/file/test +14 -8
index 0d5ed0e..fa28b7c 100755
@@ -26,6 +26,12 @@ system "rm -f $basedir/temp_file 2>&1";
 system "rm -f $basedir/temp_file2 2>&1";
 system "rm -f $basedir/temp_file3 2>&1";
 
+# The test relies on the legacy TIOCSTI ioctl
+$flip_legacy_tiocsti = `sysctl -bn dev.tty.legacy_tiocsti 2>/dev/null` eq "0";
+if ($flip_legacy_tiocsti) {
+    system "sysctl -w dev.tty.legacy_tiocsti=1";
+}
+
 #
 # Create the temp files
 #
@@ -99,10 +105,8 @@ ok( $result, 0 );
 #
 # Attempt to create a SIGIO as the 'good' domain.
 #
-# Temporarily disabled - see:
-# https://lore.kernel.org/selinux/CAHC9VhQwrjwdW27+ktcT_9q-N7AmuUK8GYgoYbPXGVAcjwA4nQ@mail.gmail.com/T/
-#$result = system "runcon -t test_fileop_t -- $basedir/test_sigiotask 2>&1";
-ok(1);
+$result = system "runcon -t test_fileop_t -- $basedir/test_sigiotask 2>&1";
+ok( $result, 0 );
 
 #
 # Attempt to access the restricted file as the 'bad' domain. The first test
@@ -153,10 +157,8 @@ ok( $result, 0 );
 #
 # Attempt to create a SIGIO as the 'bad' domain.
 #
-# Temporarily disabled - see:
-# https://lore.kernel.org/selinux/CAHC9VhQwrjwdW27+ktcT_9q-N7AmuUK8GYgoYbPXGVAcjwA4nQ@mail.gmail.com/T/
-#$result = system "runcon -t test_nofileop_t -- $basedir/test_sigiotask 2>&1";
-ok(1);
+$result = system "runcon -t test_nofileop_t -- $basedir/test_sigiotask 2>&1";
+ok($result);
 
 #
 # Delete the temp files
@@ -165,4 +167,8 @@ system "rm -f $basedir/temp_file 2>&1";
 system "rm -f $basedir/temp_file2 2>&1";
 system "rm -f $basedir/temp_file3 2>&1";
 
+if ($flip_legacy_tiocsti) {
+    system "sysctl -w dev.tty.legacy_tiocsti=0";
+}
+
 exit;
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ondrej Mosnacek

Adjust the test to temporarily set the dev.tty.legacy_tiocsti sysctl to 1 if it is 0 and re-enable the SIGIO tests.

---

Quoted 8 lines

The dev.tty.legacy_tiocsti sysctl fix is now in mainline as commit f1aa2eb5ea05 ("sysctl: fix proc_dobool() usability"), so we can use it to re-enable the SIGIO tests.

Passes the CI with the latest kernel-secnext kernel.

 tests/file/test | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

Thanks Ondrej.

Signature · 1 line
paul-moore.com
author Applied
#2 lore raw
Quoted 13 lines · Paul Moore
Quoted 11 lines · Ondrej Mosnacek

Adjust the test to temporarily set the dev.tty.legacy_tiocsti sysctl to 1 if it is 0 and re-enable the SIGIO tests.

---

The dev.tty.legacy_tiocsti sysctl fix is now in mainline as commit f1aa2eb5ea05 ("sysctl: fix proc_dobool() usability"), so we can use it to re-enable the SIGIO tests.

Quoted 8 lines
Quoted 4 lines

Passes the CI with the latest kernel-secnext kernel.

 tests/file/test | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

Thanks Ondrej.

Thanks, applied:
https://github.com/SELinuxProject/selinux-testsuite/commit/5fc5dc9f5964aae3a6dce57178b25ddc49d21415

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