[tip: sched/core] sched: Don't report SCHED_FLAG_SUGOV in sched_getattr()
From: tip-bot2 for Quentin Perret
Date: Thu Aug 05 2021 - 05:34:58 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 7ad721bf10718a4e480a27ded8bb16b8f6feb2d1
Gitweb: https://git.kernel.org/tip/7ad721bf10718a4e480a27ded8bb16b8f6feb2d1
Author: Quentin Perret <qperret@xxxxxxxxxx>
AuthorDate: Tue, 27 Jul 2021 11:11:02 +01:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Wed, 04 Aug 2021 15:16:44 +02:00
sched: Don't report SCHED_FLAG_SUGOV in sched_getattr()
SCHED_FLAG_SUGOV is supposed to be a kernel-only flag that userspace
cannot interact with. However, sched_getattr() currently reports it
in sched_flags if called on a sugov worker even though it is not
actually defined in a UAPI header. To avoid this, make sure to
clean-up the sched_flags field in sched_getattr() before returning to
userspace.
Signed-off-by: Quentin Perret <qperret@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20210727101103.2729607-3-qperret@xxxxxxxxxx
---
kernel/sched/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 6c562ad..314f70d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7530,6 +7530,7 @@ SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
kattr.sched_priority = p->rt_priority;
else
kattr.sched_nice = task_nice(p);
+ kattr.sched_flags &= SCHED_FLAG_ALL;
#ifdef CONFIG_UCLAMP_TASK
/*