Hello,

On 25/02/26 10:51, Gabriele Monaco wrote:
> Add the deadline monitors collection to validate the deadline scheduler,
> both for deadline tasks and servers.
> 
> The currently implemented monitors are:
> * throttle:
>     validate dl entities are throttled when they use up their runtime
> * nomiss:
>     validate dl entities run to completion before their deadiline
> 
> Cc: Peter Zijlstra <[email protected]>
> Reviewed-by: Nam Cao <[email protected]>
> Signed-off-by: Gabriele Monaco <[email protected]>
> ---

...

> +static inline int extract_params(struct pt_regs *regs, long id, struct 
> task_struct **p)
> +{
> +     size_t size = offsetof(struct sched_attr, sched_nice);
> +     struct sched_attr __user *uattr, attr;
> +     int new_policy = -1, ret;
> +     unsigned long args[6];
> +     pid_t pid;
> +
> +     switch (id) {
> +     case __NR_sched_setscheduler:
> +             syscall_get_arguments(current, regs, args);
> +             pid = args[0];
> +             new_policy = args[1];
> +             break;
> +     case __NR_sched_setattr:
> +             syscall_get_arguments(current, regs, args);
> +             pid = args[0];
> +             uattr = (void *)args[1];
> +             /*
> +              * Just copy up to sched_flags, we are not interested after that
> +              */
> +             ret = copy_struct_from_user(&attr, size, uattr, size);
> +             if (ret)
> +                     return ret;
> +             if (attr.sched_flags & SCHED_FLAG_KEEP_POLICY)
> +                     return -EINVAL;
> +             new_policy = attr.sched_policy;
> +             break;
> +     default:
> +             return -EINVAL;
> +     }
> +     if (!pid)
> +             *p = current;
> +     else {
> +             /*
> +              * Required for find_task_by_vpid, make sure the caller doesn't
> +              * need to get_task_struct().
> +              */
> +             guard(rcu)();
> +             *p = find_task_by_vpid(pid);
> +             if (unlikely(!*p))
> +                     return -EINVAL;
> +     }

Not sure I get this comment. RCU is released when the function returns,
but then the task pointer is dereferenced by callers?

Thanks,
Juri


Reply via email to