[PATCH 3/4] selinux-testsuite: enable task_setscheduler to work with cgroups

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

 



On recent systemd based distributions, systemd manages cgroups
automatically and we may be running in a cgroup by default.
Unfortunately, this can cause problems when trying to set the
scheduler policy so we need to move the target process to the root
cgroup (no scheduler policy restrictions in the root cgroup) before
we attempt to change the scheduler settings.

Signed-off-by: Paul Moore <pmoore@xxxxxxxxxx>
---
 0 files changed

diff --git a/tests/task_setscheduler/test b/tests/task_setscheduler/test
index f1b71eb..f63db07 100755
--- a/tests/task_setscheduler/test
+++ b/tests/task_setscheduler/test
@@ -12,6 +12,15 @@ if ( ($pid = fork()) == 0 ) {
 
 sleep 1; # Give it a second to start
 
+$cgroup_cpu = "/sys/fs/cgroup/cpu/tasks";
+if ( -w $cgroup_cpu ) {
+	# We can only set the scheduler policy fo SCHED_{RR,FIFO} in the root
+	# cgroup so move our target process to the root cgroup.
+	open(my $fd, ">>", $cgroup_cpu);
+	print $fd $pid;
+	close $fd;
+}
+
 # Verify that test_setsched_yes_t can change the scheduling.
 # SCHED_OTHER	0	priority must == 0
 # SCHED_FIFO	1	priority 1..99

_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.




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

  Powered by Linux