diff mbox series

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

Message ID 20230301094130.736231-1-omosnace@redhat.com (mailing list archive)
State Accepted
Delegated to: Ondrej Mosnáček
Headers show
Series [testsuite] tests/file: make the SIGIO tests work with CONFIG_LEGACY_TIOCSTI=n | expand

Commit Message

Ondrej Mosnacek March 1, 2023, 9:41 a.m. UTC
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@redhat.com>
---

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

Comments

Paul Moore March 1, 2023, 3:09 p.m. UTC | #1
On Wed, Mar 1, 2023 at 4:42 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> 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@redhat.com>
> ---
>
> 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.

Reviewed-by: Paul Moore <paul@paul-moore.com>
Ondrej Mosnacek March 3, 2023, 2:12 p.m. UTC | #2
On Wed, Mar 1, 2023 at 4:09 PM Paul Moore <paul@paul-moore.com> wrote:
>
> On Wed, Mar 1, 2023 at 4:42 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> >
> > 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@redhat.com>
> > ---
> >
> > 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.
>
> Reviewed-by: Paul Moore <paul@paul-moore.com>

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

Patch

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@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;