[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190905120540.162032542@linutronix.de>
Date: Thu, 05 Sep 2019 14:03:45 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
Ingo Molnar <mingo@...nel.org>,
Kees Cook <keescook@...omium.org>
Subject: [patch 6/6] posix-cpu-timers: Make PID=0 and PID=self handling
consistent
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@...utronix.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;
Powered by blists - more mailing lists