[Devel] [PATCH RH9 11/12] sched: prohibit setting affinity from inside a CT

Alexander Mikhalitsyn alexander.mikhalitsyn at virtuozzo.com
Thu Sep 23 14:31:35 MSK 2021


From: Konstantin Khorenko <khorenko at virtuozzo.com>

Signed-off-by: OpenVZ Team <devel at openvz.org>
Extracted by Konstantin Khorenko <khorenko at virtuozzo.com>
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>

https://jira.sw.ru/browse/PSBM-133986

(cherry picked from commit b055e02b4378443778b38ef77712b803f9bcb19f)
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 kernel/sched/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a32a7626f458..064482744ac7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7710,6 +7710,9 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
 	struct task_struct *p;
 	int retval;
 
+	if (!ve_is_super(get_exec_env()))
+		return 0;
+
 	rcu_read_lock();
 
 	p = find_process_by_pid(pid);
-- 
2.31.1



More information about the Devel mailing list