lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 23 Sep 2019 16:54:39 +0200
From:   Thomas Gleixner <tglx@...utronix.de>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     Frederic Weisbecker <fweisbec@...il.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        Oleg Nesterov <oleg@...hat.com>,
        Michael Kerrisk <mtk.manpages@...glemail.com>,
        Kees Cook <keescook@...omium.org>,
        Frederic Weisbecker <frederic@...nel.org>
Subject: [patch V2 4/6] posix-cpu-timers: Make PID=0 and PID=self handling
 consistent

From: Thomas Gleixner <tglx@...utronix.de>

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>
Reviewed-by: Frederic Weisbecker <frederic@...nel.org>
---
V2: Remove the extra same_thread_group() check which is pointless.
---
 kernel/time/posix-cpu-timers.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -90,18 +90,20 @@ static struct task_struct *lookup_task(c
 
 	} else {
 		/*
+		 * Timer is going to be attached to a process. If p is
+		 * current then treat it like the PID=0 case above.
+		 * This also avoids the ptrace overhead.
+		 */
+		if (p == current)
+			return current->group_leader;
+
+		/*
 		 * Process wide timers need the group leader because they
 		 * take a reference on it and store the task pointer until
 		 * the timer is destroyed.
 		 */
 		if (!has_group_leader_pid(p))
 			return NULL;
-
-		/*
-		 * Avoid the ptrace overhead when this is current's process
-		 */
-		if (same_thread_group(p, current))
-			return p;
 	}
 
 	/* Decide based on the ptrace permissions. */


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ