mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Josh Don <joshdon@google.com>
Cc: Joel Fernandes <joel@joelfernandes.org>,
	Chris Hyser <chris.hyser@oracle.com>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Peter Collingbourne <pcc@google.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mel Gorman <mgorman@suse.de>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Balbir Singh <sblbir@amazon.com>
Subject: Re: [resend RFC 2/3] sched/prctl: add PR_SCHED_CORE_SHARE command
Date: Tue, 25 Jan 2022 13:15:45 +0100	[thread overview]
Message-ID: <20220125121545.rul2vqgrc7io4vio@wittgenstein> (raw)
In-Reply-To: <CABk29NtFnswO3iaQobbijV1-FwCJd06prm2UMq7S8Tt736hYMA@mail.gmail.com>

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!

  reply	other threads:[~2022-01-25 12:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 10:52 [resend RFC 0/3] core scheduling: add PR_SCHED_CORE_SHARE Christian Brauner
2022-01-24 10:52 ` [resend RFC 1/3] pid: introduce task_by_pid() Christian Brauner
2022-01-26 16:56   ` Tejun Heo
2022-01-24 10:52 ` [resend RFC 2/3] sched/prctl: add PR_SCHED_CORE_SHARE command Christian Brauner
2022-01-24 17:25   ` Joel Fernandes
2022-01-25  0:31   ` Josh Don
2022-01-25 12:15     ` Christian Brauner [this message]
2022-01-24 10:52 ` [resend RFC 3/3] tests: add new PR_SCHED_CORE_SHARE test Christian Brauner
2022-01-24 17:25 ` [resend RFC 0/3] core scheduling: add PR_SCHED_CORE_SHARE Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220125121545.rul2vqgrc7io4vio@wittgenstein \
    --to=brauner@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=chris.hyser@oracle.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joel@joelfernandes.org \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=pcc@google.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sblbir@amazon.com \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®