mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC,PATCH 08/14] tracehooks: kill some PT_PTRACED checks
@ 2009-11-24 20:01 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2009-11-24 20:01 UTC (permalink / raw)
  To: Alexey Dobriyan, Ananth Mavinakayanahalli, Christoph Hellwig,
	Frank Ch. Eigler, Ingo Molnar, Peter Zijlstra, Roland McGrath
  Cc: linux-kernel, utrace-devel

No functional changes, preparation for utrace-ptrace.

task_ptrace() != 0 if and only if PT_PTRACED bit is set, kill
some PT_PTRACED checks in tracehook.h to ensure the result is
the same with or without utrace which doesn't set PT_PTRACED.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---

 include/linux/tracehook.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- V1/include/linux/tracehook.h~8_TRACEHOOK_KILL_PTRACED_CHECKS	2009-11-24 19:52:10.000000000 +0100
+++ V1/include/linux/tracehook.h	2009-11-24 20:29:07.000000000 +0100
@@ -156,7 +156,7 @@ static inline int tracehook_unsafe_exec(
 {
 	int unsafe = 0;
 	int ptrace = task_ptrace(task);
-	if (ptrace & PT_PTRACED) {
+	if (ptrace) {
 		if (ptrace & PT_PTRACE_CAP)
 			unsafe |= LSM_UNSAFE_PTRACE_CAP;
 		else
@@ -178,7 +178,7 @@ static inline int tracehook_unsafe_exec(
  */
 static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk)
 {
-	if (task_ptrace(tsk) & PT_PTRACED)
+	if (task_ptrace(tsk))
 		return rcu_dereference(tsk->parent);
 	return NULL;
 }
@@ -492,7 +492,7 @@ static inline int tracehook_get_signal(s
  */
 static inline int tracehook_notify_jctl(int notify, int why)
 {
-	return notify ?: (current->ptrace & PT_PTRACED) ? why : 0;
+	return notify ?: task_ptrace(current) ? why : 0;
 }
 
 /**


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-24 20:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-24 20:01 [RFC,PATCH 08/14] tracehooks: kill some PT_PTRACED checks Oleg Nesterov

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®