Re: [PATCH v2] sched/deadline: Fix sched_getattr() for DL tasks

From: Juri Lelli
Date: Fri Jul 30 2021 - 05:22:27 EST


Hi,

On 29/07/21 18:52, Quentin Perret wrote:
> In its current state, sched_getattr() can report incorrect sched_flags
> if called on a deadline task.
>
> Firstly, if the reset_on_fork flag is set on a deadline task using
> sched_setattr() with SCHED_FLAG_RESET_ON_FORK | SCHED_FLAG_KEEP_PARAMS,
> p->sched_reset_on_fork will be set but __setscheduler() will bail out
> early without updating the dl_se->flags. Consequently, if sched_getattr
> is then called on the same task, __getparam_dl() will override
> kattr.sched_flags with the now out-of-date copy in dl_se->flags and
> report a stale reset_on_fork value to userspace.
>
> And secondly, sched_getattr() currently reports SCHED_FLAG_SUGOV as set
> if called on a schedutil worker, despite this flag being a kernel-only
> value that is not exposed in UAPI headers.
>
> To fix both of these problems, make sure to only copy the flags that are
> relevant to sched_deadline to dl_se->flags, and filter them out when
> reporting them back to userspace.
>
> Signed-off-by: Quentin Perret <qperret@xxxxxxxxxx>

Looks good to me.

Acked-by: Juri Lelli <juri.lelli@xxxxxxxxxx>

Thanks!
Juri