lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [resend RFC 2/3] sched/prctl: add PR_SCHED_CORE_SHARE command
Hey Christian,

This seems like a reasonable extension of the interface to me.

> @@ -200,6 +212,20 @@ int sched_core_share_pid(unsigned int cmd, pid_t pid, enum pid_type type,
> __sched_core_set(current, cookie);
> goto out;
>
> + case PR_SCHED_CORE_SHARE:
> + rcu_read_lock();
> + p = task_by_pid(pid_share);
> + if (!p)
> + err = -ESRCH;
> + else if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS))
> + err = -EPERM;
> + if (!err)
> + cookie = sched_core_clone_cookie(p);
> + rcu_read_unlock();
> + if (err)
> + goto out;
> + break;
> +

Did you consider folding this into SCHED_CORE_SHARE_TO? SHARE_TO isn't
using the last arg right now; it could use it as an override for the
task we copy the cookie from instead of always choosing 'current'.
Since the code currently rejects any SCHED_CORE prctl calls with a
non-zero last arg for commands other than SCHED_CORE_GET, this would
be a safe change for userspace.

\
 
 \ /
  Last update: 2022-01-25 04:40    [W:0.142 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site