lkml.org 
[lkml]   [2011]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 5/5] ptrace: implement PTRACE_LISTEN
From
Date
On Tue, 2011-06-14 at 11:20 +0200, Tejun Heo wrote:

[...]

> + case PTRACE_LISTEN:
> + /*
> + * Listen for events. Tracee must be in STOP. It's not
> + * resumed per-se but is not considered to be in TRACED by
> + * wait(2) or ptrace(2). If an async event (e.g. group
> + * stop state change) happens, tracee will enter STOP trap
> + * again. Alternatively, ptracer can issue INTERRUPT to
> + * finish listening and re-trap tracee into STOP.
> + */
> + if (unlikely(!seized || !lock_task_sighand(child, &flags)))
> + break;
> +
> + si = child->last_siginfo;
> + if (unlikely(!si || si->si_code >> 8 != PTRACE_EVENT_STOP))
> + break;

I've only just noticed this. You really don't want to break out of the
switch while holding sighand->siglock. This should read,

if (unlikely(!si || si->si_code >> 8 != PTRACE_EVENT_STOP)) {
unlock_task_sighand(child, &flags);
break;
}
--
Matt Fleming, Intel Open Source Technology Center



\
 
 \ /
  Last update: 2011-09-23 13:19    [from the cache]
©2003-2011 Jasper Spaans