[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABk29NtFnswO3iaQobbijV1-FwCJd06prm2UMq7S8Tt736hYMA@mail.gmail.com>
Date: Mon, 24 Jan 2022 16:31:05 -0800
From: Josh Don <joshdon@...gle.com>
To: Christian Brauner <brauner@...nel.org>
Cc: Joel Fernandes <joel@...lfernandes.org>,
Chris Hyser <chris.hyser@...cle.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Peter Collingbourne <pcc@...gle.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Mel Gorman <mgorman@...e.de>,
Vincent Guittot <vincent.guittot@...aro.org>,
Juri Lelli <juri.lelli@...hat.com>,
Catalin Marinas <catalin.marinas@....com>,
Ingo Molnar <mingo@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Balbir Singh <sblbir@...zon.com>
Subject: Re: [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.
Powered by blists - more mailing lists