Re: [RFC PATCH 11/12 v2] ptrace: mv task_struct->ptrace_messageptrace_ctx->message

From: Oleg Nesterov
Date: Thu May 28 2009 - 07:45:55 EST


On 05/28, Oleg Nesterov wrote:
>
> ptrace_event() can use current->ptrace_ctx safely. If mask == 0 and we do
> not check task_ptrace() we are called from tracehook_report_clone_complete(),
> in this case trace == T means current was traced when it called do_fork().

Perhaps it is better to optimize out "mask != 0" check in ptrace_event().
This special !mask case is only needed for _report_clone(), we can use
mask == PT_PTRACED instead.

Oleg.

--- PTRACE/include/linux/ptrace.h~10_HOOK_COMPLETE 2009-05-28 11:19:33.000000000 +0200
+++ PTRACE/include/linux/ptrace.h 2009-05-28 11:49:29.000000000 +0200
@@ -157,7 +157,7 @@ int generic_ptrace_pokedata(struct task_
*/
static inline int ptrace_event(int mask, int event, unsigned long message)
{
- if (mask && likely(!(task_ptrace(current) & mask)))
+ if (likely(!(task_ptrace(current) & mask)))
return 0;
current->ptrace_message = message;
ptrace_notify((event << 8) | SIGTRAP);
--- PTRACE/include/linux/tracehook.h~10_HOOK_COMPLETE 2009-05-28 08:41:11.000000000 +0200
+++ PTRACE/include/linux/tracehook.h 2009-05-28 11:50:14.000000000 +0200
@@ -344,7 +344,7 @@ static inline void tracehook_report_clon
struct task_struct *child)
{
if (unlikely(trace))
- ptrace_event(0, trace, pid);
+ ptrace_event(PT_PTRACED, trace, pid);
}

/**

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/