[PATCH testsuite] tests/file: make the SIGIO tests work with CONFIG_LEGACY_TIOCSTI=n

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
---

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(-)

diff --git a/tests/file/test b/tests/file/test
index 0d5ed0e..fa28b7c 100755
--- a/tests/file/test
+++ b/tests/file/test
@@ -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@xxxxxxxxxxxxxx/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@xxxxxxxxxxxxxx/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;
-- 
2.39.2




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux