lkml.org 
[lkml]   [2021]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] sched: Don't report SCHED_FLAG_SUGOV in sched_getattr()
On 28/07/21 10:39, Quentin Perret wrote:
> On Wednesday 28 Jul 2021 at 11:12:03 (+0200), Juri Lelli wrote:
> > Hi Quentin,
> >
> > On 27/07/21 11:11, Quentin Perret wrote:
> > > 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>
> > > ---
> > > kernel/sched/core.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > > index 2d9ff40f4661..d8f489dcc383 100644
> > > --- a/kernel/sched/core.c
> > > +++ b/kernel/sched/core.c
> > > @@ -7535,6 +7535,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;
> >
> > Maybe we can do this in the previous patch so that it's kept confined to
> > deadline bits?
>
> That works too, it just felt like this could happen again if we start
> using non-standard flags outside of deadline for any reason at some
> point in the future. But no strong opinion really.

Yeah, I also see this point. :)

So no prob with me to keep it in core.c as you do here.

Best,
Juri

\
 
 \ /
  Last update: 2021-07-28 14:38    [W:0.052 / U:1.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site