[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220125121545.rul2vqgrc7io4vio@wittgenstein>
Date: Tue, 25 Jan 2022 13:15:45 +0100
From: Christian Brauner <brauner@...nel.org>
To: Josh Don <joshdon@...gle.com>
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
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!
Powered by blists - more mailing lists