lkml.org 
[lkml]   [2010]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 11/14] ptrace: make group stop notification reliable against ptrace
Hello,

On 11/28/2010 09:30 PM, Oleg Nesterov wrote:
> On 11/26, Tejun Heo wrote:
>>
>> Group stop notifications are unreliable if one or more tasks of the
>> task group are being ptraced. If a ptraced task ends up finishing a
>> group stop, the notification is sent to the ptracer and the real
>> parent never gets notified.
>
> Yes. I do not even know if this is bug or not, but certainly I agree,
> this doesn't look very nice.
>
>> if (likely(!task_ptrace(current))) {
>> + bool do_notify = false;
>> +
>> + if (sig->flags & SIGNAL_NOTIFY_STOP) {
>> + sig->flags &= ~SIGNAL_NOTIFY_STOP;
>> + do_notify = true;
>> + }
>> +
>> spin_unlock_irq(&current->sighand->siglock);
>>
>> - if (notify) {
>> + if (do_notify) {
>> read_lock(&tasklist_lock);
>> - do_notify_parent_cldstop(current, notify);
>> + do_notify_parent_cldstop(current, CLD_STOPPED);
>
> This can race with ptrace_attach() in between.
>
> IOW, this notification can go to the new tracer anyway.

Hmmm, okay, we should hold both locks when checking for notification
to remove that race, or we can just tell do_notify_parent_cldstop()
which parent to use.

--
tejun


\
 
 \ /
  Last update: 2010-11-29 14:55    [W:0.095 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site