linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@kernel.org>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [patch 6/6] posix-cpu-timers: Make PID=0 and PID=self handling consistent
Date: Mon, 23 Sep 2019 16:17:14 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1909231615200.2003@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20190923141324.GB10778@lenoir>

On Mon, 23 Sep 2019, Frederic Weisbecker wrote:

> On Thu, Sep 05, 2019 at 02:03:45PM +0200, Thomas Gleixner wrote:
> > If the PID encoded into the clock id is 0 then the target is either the
> > calling thread itself or the process to which it belongs.
> > 
> > If the current thread encodes its own PID on a process wide clock then
> > there is no reason not to treat it in the same way as the PID=0 case.
> > 
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > ---
> >  kernel/time/posix-cpu-timers.c |    9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > --- a/kernel/time/posix-cpu-timers.c
> > +++ b/kernel/time/posix-cpu-timers.c
> > @@ -90,7 +90,14 @@ static struct task_struct *lookup_task(c
> >  
> >  	} else {
> >  		/*
> > -		 * For processes require that p is group leader.
> > +		 * Timer is going to be attached to a process. If p is
> > +		 * current then treat it like the PID=0 case above.
> > +		 */
> > +		if (p == current)
> > +			return current->group_leader;
> > +
> > +		/*
> > +		 * For foreign processes require that p is group leader.
> >  		 */
> >  		if (!has_group_leader_pid(p))
> >  			return NULL;
> 
> So, right after you should have that:
> 
>                 if (same_thread_group(p, current))
>                         return p;
> 
> Which I suggested to convert as:
> 
>                 if (p == current)
>                         return p;

Indeed :)



  reply	other threads:[~2019-09-23 14:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 12:03 [patch 0/6] posix-cpu-timers: Fallout fixes and permission tightening Thomas Gleixner
2019-09-05 12:03 ` [patch 1/6] posix-cpu-timers: Always clear head pointer on dequeue Thomas Gleixner
2019-09-05 15:49   ` Frederic Weisbecker
2019-09-05 12:03 ` [patch 2/6] posix-cpu-timers: Fix permission check regression Thomas Gleixner
2019-09-05 17:31   ` Frederic Weisbecker
2019-09-05 18:55     ` Thomas Gleixner
2019-09-05 21:15       ` [patch V2 " Thomas Gleixner
2019-09-09 15:13         ` Frederic Weisbecker
2019-09-10 11:18         ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2019-09-05 12:03 ` [patch 3/6] posix-cpu-timers: Restrict timer_create() permissions Thomas Gleixner
2019-09-21  0:44   ` Frederic Weisbecker
2019-09-05 12:03 ` [patch 4/6] posix-cpu-timers: Restrict clock_gettime() permissions Thomas Gleixner
2019-09-23 13:39   ` Frederic Weisbecker
2019-09-05 12:03 ` [patch 5/6] posix-cpu-timers: Sanitize thread clock permissions Thomas Gleixner
2019-09-05 12:21   ` Peter Zijlstra
2019-09-05 14:11     ` Thomas Gleixner
2019-09-23 14:03   ` Frederic Weisbecker
2019-09-05 12:03 ` [patch 6/6] posix-cpu-timers: Make PID=0 and PID=self handling consistent Thomas Gleixner
2019-09-23 14:13   ` Frederic Weisbecker
2019-09-23 14:17     ` Thomas Gleixner [this message]
2019-09-05 14:48 ` [patch 0/6] posix-cpu-timers: Fallout fixes and permission tightening Frederic Weisbecker
2019-09-05 14:57   ` Thomas Gleixner
2019-09-05 15:21     ` Frederic Weisbecker
2019-09-05 20:32 ` Kees Cook
2019-09-05 21:13   ` Thomas Gleixner

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=alpine.DEB.2.21.1909231615200.2003@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).