Skip to content

Commit

Permalink
sched: Don't report SCHED_FLAG_SUGOV in sched_getattr()
Browse files Browse the repository at this point in the history
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@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210727101103.2729607-3-qperret@google.com
  • Loading branch information
Quentin Perret authored and Peter Zijlstra committed Aug 4, 2021
1 parent f950915 commit 7ad721b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
/*
Expand Down

0 comments on commit 7ad721b

Please sign in to comment.