Skip to content

Commit

Permalink
tests/file: make the SIGIO tests work with CONFIG_LEGACY_TIOCSTI=n
Browse files Browse the repository at this point in the history
Adjust the test to temporarily set the dev.tty.legacy_tiocsti sysctl to
1 if it is 0 and re-enable the SIGIO tests.

Reviewed-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
  • Loading branch information
WOnder93 committed Mar 1, 2023
1 parent 17fe947 commit 5fc5dc9
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tests/file/test
Expand Up @@ -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
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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;

0 comments on commit 5fc5dc9

Please sign in to comment.