lkml.org 
[lkml]   [2009]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [RFC PATCH 11/12 v2] ptrace: mv task_struct->ptrace_message ptrace_ctx->message
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);
}

/**


\
 
 \ /
  Last update: 2009-05-28 13:49    [W:0.153 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site