On some old kernels (e.g. RHEL-5) the setscheduler test hangs the system after commit 26a3b59d5f5a ("selinux-testsuite: fix potential races when starting bg programs"). The issue seems to be that the new 'target' program does a busy loop, whereas the old one did sleep() in a loop. Fix this by sleeping inside the loop as before. Note that the policy needs to be updated to allow running the sleep command from a test_setsched_target_t process. Fixes: 26a3b59d5f5a ("selinux-testsuite: fix potential races when starting bg programs") Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx> --- policy/test_task_setsched.te | 1 + tests/task_setscheduler/test | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/policy/test_task_setsched.te b/policy/test_task_setsched.te index 32569b7..794de65 100644 --- a/policy/test_task_setsched.te +++ b/policy/test_task_setsched.te @@ -11,6 +11,7 @@ type test_setsched_target_t; domain_type(test_setsched_target_t) unconfined_runs_test(test_setsched_target_t) corecmd_shell_entry_type(test_setsched_target_t) +corecmd_exec_bin(test_setsched_target_t) typeattribute test_setsched_target_t test_setsched_d; typeattribute test_setsched_target_t testdomain; diff --git a/tests/task_setscheduler/test b/tests/task_setscheduler/test index 9e712a8..fa7d9cb 100755 --- a/tests/task_setscheduler/test +++ b/tests/task_setscheduler/test @@ -10,7 +10,7 @@ $basedir =~ s|(.*)/[^/]*|$1|; system("mkfifo $basedir/flag"); if ( ( $pid = fork() ) == 0 ) { exec -"runcon -t test_setsched_target_t sh -c 'echo >$basedir/flag; while :; do :; done'"; +"runcon -t test_setsched_target_t sh -c 'echo >$basedir/flag; while :; do sleep 1; done'"; } # Wait for it to start. -- 2.21.0