Messages in this thread | | | Date | Tue, 25 Jan 2022 13:15:45 +0100 | From | Christian Brauner <> | Subject | Re: [resend RFC 2/3] sched/prctl: add PR_SCHED_CORE_SHARE command |
| |
On Mon, Jan 24, 2022 at 04:31:05PM -0800, Josh Don wrote: > 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.
Yeah, that sounds good to me too. I can certainly rework the patch to do that!
| |