Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363446

Re: Question regarding ptrace work for LInux v3.1

From Patrick Donnelly <pdonnel3@nd.edu>
Newsgroups linux.kernel
Subject Re: Question regarding ptrace work for LInux v3.1
Date 2016-03-23 15:20 +0100
Message-ID <rfRNE-4A8-7@gated-at.bofh.it> (permalink)
References (1 earlier) <rfc7M-z3-7@gated-at.bofh.it> <rfdGy-1FG-19@gated-at.bofh.it> <rfdGy-1FG-17@gated-at.bofh.it> <rfdGz-1FG-51@gated-at.bofh.it> <rfdQe-1Ku-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Mar 21, 2016 at 3:35 PM, Oleg Nesterov <oleg@redhat.com> wrote:
> On 03/21, Patrick Donnelly wrote:
>> On Mon, Mar 21, 2016 at 3:07 PM, Oleg Nesterov <oleg@redhat.com> wrote:
>> >         case SIGSTOP:
>> >         /* Black magic to get threads working on old Linux kernels... */
>> >
>> >         if(p->nsyscalls == 0) { /* stop before we begin running the process */
>> >                 debug(D_DEBUG, "suppressing bootstrap SIGSTOP for %d",pid);
>> >                 signum = 0; /* suppress delivery */
>> >                 kill(p->pid,SIGCONT);
>> >         }
>> >         break;
>> >
>> > doesn't look right. Note that kill(pid,SIGCONT) affects the whole thread-
>> > group. So if this kill() races with another thread doing clone() you can
>> > hit the problem you described.
>>
>> You're right, that should be tkill! I will give that a try and report
>> back if that solved the issue for our collaborators...
>
> Ah, sorry, I should have mentioned this...
>
> No, tkill() won't help. See prepare_signal(), SIGCONT always removes
> the SIG_KERNEL_STOP_MASK signals from all threads, not matter if it was
> sent by tkill() or kill().
>
> Perhaps you should just remove this kill(SIGCONT) ?
>
> tracer_continue(signr => 0) should equally suppress the delivery. To
> clarify this won't be right too, but without PTRACE_SEIZE you simply
> can't write the code which handles the stop/cont/etc events correctly
> anyway...

Thanks so much Oleg. Indeed this was the problem.

-- 
Patrick Donnelly

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Question regarding ptrace work for LInux v3.1 Oleg Nesterov <oleg@redhat.com> - 2016-03-21 18:50 +0100
  Re: Question regarding ptrace work for LInux v3.1 Oleg Nesterov <oleg@redhat.com> - 2016-03-21 20:30 +0100
    Re: Question regarding ptrace work for LInux v3.1 Patrick Donnelly <pdonnel3@nd.edu> - 2016-03-21 20:30 +0100
      Re: Question regarding ptrace work for LInux v3.1 Oleg Nesterov <oleg@redhat.com> - 2016-03-21 20:40 +0100
        Re: Question regarding ptrace work for LInux v3.1 Patrick Donnelly <pdonnel3@nd.edu> - 2016-03-23 15:20 +0100
  Re: Question regarding ptrace work for LInux v3.1 Patrick Donnelly <pdonnel3@nd.edu> - 2016-03-21 20:30 +0100

csiph-web